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_g_p_g_g(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__g_p_g_g)8 int ostei_g_p_g_g(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__g_p_g_g)
13 {
14 
15     SIMINT_ASSUME_ALIGN_DBL(work);
16     SIMINT_ASSUME_ALIGN_DBL(INT__g_p_g_g);
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__g_s_g_s = work + (SIMINT_NSHELL_SIMD * 0);
30     double * const INT__g_s_h_s = work + (SIMINT_NSHELL_SIMD * 225);
31     double * const INT__g_s_i_s = work + (SIMINT_NSHELL_SIMD * 540);
32     double * const INT__g_s_k_s = work + (SIMINT_NSHELL_SIMD * 960);
33     double * const INT__g_s_l_s = work + (SIMINT_NSHELL_SIMD * 1500);
34     double * const INT__h_s_g_s = work + (SIMINT_NSHELL_SIMD * 2175);
35     double * const INT__h_s_h_s = work + (SIMINT_NSHELL_SIMD * 2490);
36     double * const INT__h_s_i_s = work + (SIMINT_NSHELL_SIMD * 2931);
37     double * const INT__h_s_k_s = work + (SIMINT_NSHELL_SIMD * 3519);
38     double * const INT__h_s_l_s = work + (SIMINT_NSHELL_SIMD * 4275);
39     SIMINT_DBLTYPE * const primwork = (SIMINT_DBLTYPE *)(work + SIMINT_NSHELL_SIMD*5220);
40     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_s_s = primwork + 0;
41     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_p_s = primwork + 14;
42     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_d_s = primwork + 53;
43     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_f_s = primwork + 125;
44     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_g_s = primwork + 235;
45     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_h_s = primwork + 385;
46     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_i_s = primwork + 574;
47     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_k_s = primwork + 798;
48     SIMINT_DBLTYPE * const restrict PRIM_INT__s_s_l_s = primwork + 1050;
49     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_s_s = primwork + 1320;
50     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_p_s = primwork + 1335;
51     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_d_s = primwork + 1380;
52     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_f_s = primwork + 1470;
53     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_g_s = primwork + 1620;
54     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_h_s = primwork + 1845;
55     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_i_s = primwork + 2160;
56     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_k_s = primwork + 2580;
57     SIMINT_DBLTYPE * const restrict PRIM_INT__p_s_l_s = primwork + 3120;
58     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_p_s = primwork + 3795;
59     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_d_s = primwork + 3867;
60     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_f_s = primwork + 4011;
61     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_g_s = primwork + 4251;
62     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_h_s = primwork + 4611;
63     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_i_s = primwork + 5115;
64     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_k_s = primwork + 5787;
65     SIMINT_DBLTYPE * const restrict PRIM_INT__d_s_l_s = primwork + 6651;
66     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_d_s = primwork + 7731;
67     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_f_s = primwork + 7911;
68     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_g_s = primwork + 8211;
69     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_h_s = primwork + 8661;
70     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_i_s = primwork + 9291;
71     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_k_s = primwork + 10131;
72     SIMINT_DBLTYPE * const restrict PRIM_INT__f_s_l_s = primwork + 11211;
73     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_f_s = primwork + 12561;
74     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_g_s = primwork + 12861;
75     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_h_s = primwork + 13311;
76     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_i_s = primwork + 13941;
77     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_k_s = primwork + 14781;
78     SIMINT_DBLTYPE * const restrict PRIM_INT__g_s_l_s = primwork + 15861;
79     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_g_s = primwork + 17211;
80     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_h_s = primwork + 17526;
81     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_i_s = primwork + 17967;
82     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_k_s = primwork + 18555;
83     SIMINT_DBLTYPE * const restrict PRIM_INT__h_s_l_s = primwork + 19311;
84     double * const hrrwork = (double *)(primwork + 20256);
85     double * const HRR_INT__g_p_g_s = hrrwork + 0;
86     double * const HRR_INT__g_p_g_p = hrrwork + 675;
87     double * const HRR_INT__g_p_g_d = hrrwork + 2700;
88     double * const HRR_INT__g_p_g_f = hrrwork + 6750;
89     double * const HRR_INT__g_p_h_s = hrrwork + 13500;
90     double * const HRR_INT__g_p_h_p = hrrwork + 14445;
91     double * const HRR_INT__g_p_h_d = hrrwork + 17280;
92     double * const HRR_INT__g_p_h_f = hrrwork + 22950;
93     double * const HRR_INT__g_p_i_s = hrrwork + 32400;
94     double * const HRR_INT__g_p_i_p = hrrwork + 33660;
95     double * const HRR_INT__g_p_i_d = hrrwork + 37440;
96     double * const HRR_INT__g_p_k_s = hrrwork + 45000;
97     double * const HRR_INT__g_p_k_p = hrrwork + 46620;
98     double * const HRR_INT__g_p_l_s = hrrwork + 51480;
99 
100 
101     // Create constants
102     const SIMINT_DBLTYPE const_1 = SIMINT_DBLSET1(1);
103     const SIMINT_DBLTYPE const_2 = SIMINT_DBLSET1(2);
104     const SIMINT_DBLTYPE const_3 = SIMINT_DBLSET1(3);
105     const SIMINT_DBLTYPE const_4 = SIMINT_DBLSET1(4);
106     const SIMINT_DBLTYPE const_5 = SIMINT_DBLSET1(5);
107     const SIMINT_DBLTYPE const_6 = SIMINT_DBLSET1(6);
108     const SIMINT_DBLTYPE const_7 = SIMINT_DBLSET1(7);
109     const SIMINT_DBLTYPE const_8 = SIMINT_DBLSET1(8);
110     const SIMINT_DBLTYPE one_half = SIMINT_DBLSET1(0.5);
111 
112 
113     ////////////////////////////////////////
114     // Loop over shells and primitives
115     ////////////////////////////////////////
116 
117     real_abcd = 0;
118     istart = 0;
119     for(ab = 0; ab < P.nshell12_clip; ++ab)
120     {
121         const int iend = istart + P.nprim12[ab];
122 
123         cd = 0;
124         jstart = 0;
125 
126         for(cd = 0; cd < Q.nshell12_clip; cd += SIMINT_NSHELL_SIMD)
127         {
128             const int nshellbatch = ((cd + SIMINT_NSHELL_SIMD) > Q.nshell12_clip) ? Q.nshell12_clip - cd : SIMINT_NSHELL_SIMD;
129             int jend = jstart;
130             for(i = 0; i < nshellbatch; i++)
131                 jend += Q.nprim12[cd+i];
132 
133             // Clear the beginning of the workspace (where we are accumulating integrals)
134             memset(work, 0, SIMINT_NSHELL_SIMD * 5220 * sizeof(double));
135             abcd = 0;
136 
137 
138             for(i = istart; i < iend; ++i)
139             {
140                 SIMINT_DBLTYPE bra_screen_max;  // only used if check_screen
141 
142                 if(check_screen)
143                 {
144                     // Skip this whole thing if always insignificant
145                     if((P.screen[i] * Q.screen_max) < screen_tol)
146                         continue;
147                     bra_screen_max = SIMINT_DBLSET1(P.screen[i]);
148                 }
149 
150                 icd = 0;
151                 iprimcd = 0;
152                 nprim_icd = Q.nprim12[cd];
153                 double * restrict PRIM_PTR_INT__g_s_g_s = INT__g_s_g_s + abcd * 225;
154                 double * restrict PRIM_PTR_INT__g_s_h_s = INT__g_s_h_s + abcd * 315;
155                 double * restrict PRIM_PTR_INT__g_s_i_s = INT__g_s_i_s + abcd * 420;
156                 double * restrict PRIM_PTR_INT__g_s_k_s = INT__g_s_k_s + abcd * 540;
157                 double * restrict PRIM_PTR_INT__g_s_l_s = INT__g_s_l_s + abcd * 675;
158                 double * restrict PRIM_PTR_INT__h_s_g_s = INT__h_s_g_s + abcd * 315;
159                 double * restrict PRIM_PTR_INT__h_s_h_s = INT__h_s_h_s + abcd * 441;
160                 double * restrict PRIM_PTR_INT__h_s_i_s = INT__h_s_i_s + abcd * 588;
161                 double * restrict PRIM_PTR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
162                 double * restrict PRIM_PTR_INT__h_s_l_s = INT__h_s_l_s + abcd * 945;
163 
164 
165 
166                 // Load these one per loop over i
167                 const SIMINT_DBLTYPE P_alpha = SIMINT_DBLSET1(P.alpha[i]);
168                 const SIMINT_DBLTYPE P_prefac = SIMINT_DBLSET1(P.prefac[i]);
169                 const SIMINT_DBLTYPE Pxyz[3] = { SIMINT_DBLSET1(P.x[i]), SIMINT_DBLSET1(P.y[i]), SIMINT_DBLSET1(P.z[i]) };
170 
171                 const SIMINT_DBLTYPE P_PA[3] = { SIMINT_DBLSET1(P.PA_x[i]), SIMINT_DBLSET1(P.PA_y[i]), SIMINT_DBLSET1(P.PA_z[i]) };
172 
173                 for(j = jstart; j < jend; j += SIMINT_SIMD_LEN)
174                 {
175                     // calculate the shell offsets
176                     // these are the offset from the shell pointed to by cd
177                     // for each element
178                     int shelloffsets[SIMINT_SIMD_LEN] = {0};
179                     int lastoffset = 0;
180                     const int nlane = ( ((j + SIMINT_SIMD_LEN) < jend) ? SIMINT_SIMD_LEN : (jend - j));
181 
182                     if((iprimcd + SIMINT_SIMD_LEN) >= nprim_icd)
183                     {
184                         // Handle if the first element of the vector is a new shell
185                         if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
186                         {
187                             nprim_icd += Q.nprim12[cd + (++icd)];
188                             PRIM_PTR_INT__g_s_g_s += 225;
189                             PRIM_PTR_INT__g_s_h_s += 315;
190                             PRIM_PTR_INT__g_s_i_s += 420;
191                             PRIM_PTR_INT__g_s_k_s += 540;
192                             PRIM_PTR_INT__g_s_l_s += 675;
193                             PRIM_PTR_INT__h_s_g_s += 315;
194                             PRIM_PTR_INT__h_s_h_s += 441;
195                             PRIM_PTR_INT__h_s_i_s += 588;
196                             PRIM_PTR_INT__h_s_k_s += 756;
197                             PRIM_PTR_INT__h_s_l_s += 945;
198                         }
199                         iprimcd++;
200                         for(n = 1; n < SIMINT_SIMD_LEN; ++n)
201                         {
202                             if(iprimcd >= nprim_icd && ((icd+1) < nshellbatch))
203                             {
204                                 shelloffsets[n] = shelloffsets[n-1] + 1;
205                                 lastoffset++;
206                                 nprim_icd += Q.nprim12[cd + (++icd)];
207                             }
208                             else
209                                 shelloffsets[n] = shelloffsets[n-1];
210                             iprimcd++;
211                         }
212                     }
213                     else
214                         iprimcd += SIMINT_SIMD_LEN;
215 
216                     // Do we have to compute this vector (or has it been screened out)?
217                     // (not_screened != 0 means we have to do this vector)
218                     if(check_screen)
219                     {
220                         const double vmax = vector_max(SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j)));
221                         if(vmax < screen_tol)
222                         {
223                             PRIM_PTR_INT__g_s_g_s += lastoffset*225;
224                             PRIM_PTR_INT__g_s_h_s += lastoffset*315;
225                             PRIM_PTR_INT__g_s_i_s += lastoffset*420;
226                             PRIM_PTR_INT__g_s_k_s += lastoffset*540;
227                             PRIM_PTR_INT__g_s_l_s += lastoffset*675;
228                             PRIM_PTR_INT__h_s_g_s += lastoffset*315;
229                             PRIM_PTR_INT__h_s_h_s += lastoffset*441;
230                             PRIM_PTR_INT__h_s_i_s += lastoffset*588;
231                             PRIM_PTR_INT__h_s_k_s += lastoffset*756;
232                             PRIM_PTR_INT__h_s_l_s += lastoffset*945;
233                             continue;
234                         }
235                     }
236 
237                     const SIMINT_DBLTYPE Q_alpha = SIMINT_DBLLOAD(Q.alpha, j);
238                     const SIMINT_DBLTYPE PQalpha_mul = SIMINT_MUL(P_alpha, Q_alpha);
239                     const SIMINT_DBLTYPE PQalpha_sum = SIMINT_ADD(P_alpha, Q_alpha);
240                     const SIMINT_DBLTYPE one_over_PQalpha_sum = SIMINT_DIV(const_1, PQalpha_sum);
241 
242 
243                     /* construct R2 = (Px - Qx)**2 + (Py - Qy)**2 + (Pz -Qz)**2 */
244                     SIMINT_DBLTYPE PQ[3];
245                     PQ[0] = SIMINT_SUB(Pxyz[0], SIMINT_DBLLOAD(Q.x, j));
246                     PQ[1] = SIMINT_SUB(Pxyz[1], SIMINT_DBLLOAD(Q.y, j));
247                     PQ[2] = SIMINT_SUB(Pxyz[2], SIMINT_DBLLOAD(Q.z, j));
248                     SIMINT_DBLTYPE R2 = SIMINT_MUL(PQ[0], PQ[0]);
249                     R2 = SIMINT_FMADD(PQ[1], PQ[1], R2);
250                     R2 = SIMINT_FMADD(PQ[2], PQ[2], R2);
251 
252                     const SIMINT_DBLTYPE alpha = SIMINT_MUL(PQalpha_mul, one_over_PQalpha_sum); // alpha from MEST
253                     const SIMINT_DBLTYPE one_over_p = SIMINT_DIV(const_1, P_alpha);
254                     const SIMINT_DBLTYPE one_over_q = SIMINT_DIV(const_1, Q_alpha);
255                     const SIMINT_DBLTYPE one_over_2p = SIMINT_MUL(one_half, one_over_p);
256                     const SIMINT_DBLTYPE one_over_2q = SIMINT_MUL(one_half, one_over_q);
257                     const SIMINT_DBLTYPE one_over_2pq = SIMINT_MUL(one_half, one_over_PQalpha_sum);
258                     const SIMINT_DBLTYPE Q_PA[3] = { SIMINT_DBLLOAD(Q.PA_x, j), SIMINT_DBLLOAD(Q.PA_y, j), SIMINT_DBLLOAD(Q.PA_z, j) };
259 
260                     // NOTE: Minus sign!
261                     const SIMINT_DBLTYPE a_over_p = SIMINT_MUL(SIMINT_NEG(alpha), one_over_p);
262                     SIMINT_DBLTYPE aop_PQ[3];
263                     aop_PQ[0] = SIMINT_MUL(a_over_p, PQ[0]);
264                     aop_PQ[1] = SIMINT_MUL(a_over_p, PQ[1]);
265                     aop_PQ[2] = SIMINT_MUL(a_over_p, PQ[2]);
266 
267                     SIMINT_DBLTYPE a_over_q = SIMINT_MUL(alpha, one_over_q);
268                     SIMINT_DBLTYPE aoq_PQ[3];
269                     aoq_PQ[0] = SIMINT_MUL(a_over_q, PQ[0]);
270                     aoq_PQ[1] = SIMINT_MUL(a_over_q, PQ[1]);
271                     aoq_PQ[2] = SIMINT_MUL(a_over_q, PQ[2]);
272                     // Put a minus sign here so we don't have to in RR routines
273                     a_over_q = SIMINT_NEG(a_over_q);
274 
275 
276                     //////////////////////////////////////////////
277                     // Fjt function section
278                     // Maximum v value: 13
279                     //////////////////////////////////////////////
280                     // The parameter to the Fjt function
281                     const SIMINT_DBLTYPE F_x = SIMINT_MUL(R2, alpha);
282 
283 
284                     const SIMINT_DBLTYPE Q_prefac = mask_load(nlane, Q.prefac + j);
285 
286 
287                     boys_F_split(PRIM_INT__s_s_s_s, F_x, 13);
288                     SIMINT_DBLTYPE prefac = SIMINT_SQRT(one_over_PQalpha_sum);
289                     prefac = SIMINT_MUL(SIMINT_MUL(P_prefac, Q_prefac), prefac);
290                     for(n = 0; n <= 13; n++)
291                         PRIM_INT__s_s_s_s[n] = SIMINT_MUL(PRIM_INT__s_s_s_s[n], prefac);
292 
293                     //////////////////////////////////////////////
294                     // Primitive integrals: Vertical recurrance
295                     //////////////////////////////////////////////
296 
297                     const SIMINT_DBLTYPE vrr_const_1_over_2p = one_over_2p;
298                     const SIMINT_DBLTYPE vrr_const_2_over_2p = SIMINT_MUL(const_2, one_over_2p);
299                     const SIMINT_DBLTYPE vrr_const_3_over_2p = SIMINT_MUL(const_3, one_over_2p);
300                     const SIMINT_DBLTYPE vrr_const_4_over_2p = SIMINT_MUL(const_4, one_over_2p);
301                     const SIMINT_DBLTYPE vrr_const_1_over_2q = one_over_2q;
302                     const SIMINT_DBLTYPE vrr_const_2_over_2q = SIMINT_MUL(const_2, one_over_2q);
303                     const SIMINT_DBLTYPE vrr_const_3_over_2q = SIMINT_MUL(const_3, one_over_2q);
304                     const SIMINT_DBLTYPE vrr_const_4_over_2q = SIMINT_MUL(const_4, one_over_2q);
305                     const SIMINT_DBLTYPE vrr_const_5_over_2q = SIMINT_MUL(const_5, one_over_2q);
306                     const SIMINT_DBLTYPE vrr_const_6_over_2q = SIMINT_MUL(const_6, one_over_2q);
307                     const SIMINT_DBLTYPE vrr_const_7_over_2q = SIMINT_MUL(const_7, one_over_2q);
308                     const SIMINT_DBLTYPE vrr_const_1_over_2pq = one_over_2pq;
309                     const SIMINT_DBLTYPE vrr_const_2_over_2pq = SIMINT_MUL(const_2, one_over_2pq);
310                     const SIMINT_DBLTYPE vrr_const_3_over_2pq = SIMINT_MUL(const_3, one_over_2pq);
311                     const SIMINT_DBLTYPE vrr_const_4_over_2pq = SIMINT_MUL(const_4, one_over_2pq);
312                     const SIMINT_DBLTYPE vrr_const_5_over_2pq = SIMINT_MUL(const_5, one_over_2pq);
313                     const SIMINT_DBLTYPE vrr_const_6_over_2pq = SIMINT_MUL(const_6, one_over_2pq);
314                     const SIMINT_DBLTYPE vrr_const_7_over_2pq = SIMINT_MUL(const_7, one_over_2pq);
315                     const SIMINT_DBLTYPE vrr_const_8_over_2pq = SIMINT_MUL(const_8, one_over_2pq);
316 
317 
318 
319                     // Forming PRIM_INT__s_s_p_s[13 * 3];
320                     for(n = 0; n < 13; ++n)  // loop over orders of auxiliary function
321                     {
322 
323                         PRIM_INT__s_s_p_s[n * 3 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
324                         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]);
325 
326                         PRIM_INT__s_s_p_s[n * 3 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
327                         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]);
328 
329                         PRIM_INT__s_s_p_s[n * 3 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
330                         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]);
331 
332                     }
333 
334 
335 
336                     // Forming PRIM_INT__s_s_d_s[12 * 6];
337                     for(n = 0; n < 12; ++n)  // loop over orders of auxiliary function
338                     {
339 
340                         PRIM_INT__s_s_d_s[n * 6 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
341                         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]);
342                         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]);
343 
344                         PRIM_INT__s_s_d_s[n * 6 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
345                         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]);
346 
347                         PRIM_INT__s_s_d_s[n * 6 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
348                         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]);
349 
350                         PRIM_INT__s_s_d_s[n * 6 + 3] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
351                         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]);
352                         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]);
353 
354                         PRIM_INT__s_s_d_s[n * 6 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
355                         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]);
356 
357                         PRIM_INT__s_s_d_s[n * 6 + 5] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
358                         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]);
359                         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]);
360 
361                     }
362 
363 
364 
365                     // Forming PRIM_INT__s_s_f_s[11 * 10];
366                     for(n = 0; n < 11; ++n)  // loop over orders of auxiliary function
367                     {
368 
369                         PRIM_INT__s_s_f_s[n * 10 + 0] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
370                         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]);
371                         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]);
372 
373                         PRIM_INT__s_s_f_s[n * 10 + 1] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
374                         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]);
375 
376                         PRIM_INT__s_s_f_s[n * 10 + 2] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
377                         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]);
378 
379                         PRIM_INT__s_s_f_s[n * 10 + 3] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
380                         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]);
381 
382                         PRIM_INT__s_s_f_s[n * 10 + 4] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
383                         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]);
384 
385                         PRIM_INT__s_s_f_s[n * 10 + 5] = SIMINT_MUL(Q_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
386                         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]);
387 
388                         PRIM_INT__s_s_f_s[n * 10 + 6] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
389                         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]);
390                         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]);
391 
392                         PRIM_INT__s_s_f_s[n * 10 + 7] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
393                         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]);
394 
395                         PRIM_INT__s_s_f_s[n * 10 + 8] = SIMINT_MUL(Q_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
396                         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]);
397 
398                         PRIM_INT__s_s_f_s[n * 10 + 9] = SIMINT_MUL(Q_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
399                         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]);
400                         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]);
401 
402                     }
403 
404 
405                     VRR_K_s_s_g_s(
406                             PRIM_INT__s_s_g_s,
407                             PRIM_INT__s_s_f_s,
408                             PRIM_INT__s_s_d_s,
409                             Q_PA,
410                             a_over_q,
411                             aoq_PQ,
412                             one_over_2q,
413                             10);
414 
415 
416                     VRR_I_p_s_g_s(
417                             PRIM_INT__p_s_g_s,
418                             PRIM_INT__s_s_g_s,
419                             PRIM_INT__s_s_f_s,
420                             P_PA,
421                             aop_PQ,
422                             one_over_2pq,
423                             5);
424 
425 
426                     VRR_I_p_s_f_s(
427                             PRIM_INT__p_s_f_s,
428                             PRIM_INT__s_s_f_s,
429                             PRIM_INT__s_s_d_s,
430                             P_PA,
431                             aop_PQ,
432                             one_over_2pq,
433                             5);
434 
435 
436                     ostei_general_vrr_I(2, 0, 4, 0, 4,
437                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
438                             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);
439 
440 
441 
442                     // Forming PRIM_INT__p_s_d_s[5 * 18];
443                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
444                     {
445 
446                         PRIM_INT__p_s_d_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 0]);
447                         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]);
448                         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]);
449 
450                         PRIM_INT__p_s_d_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 1]);
451                         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]);
452                         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]);
453 
454                         PRIM_INT__p_s_d_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 2]);
455                         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]);
456                         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]);
457 
458                         PRIM_INT__p_s_d_s[n * 18 + 3] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 3]);
459                         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]);
460 
461                         PRIM_INT__p_s_d_s[n * 18 + 4] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 4]);
462                         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]);
463 
464                         PRIM_INT__p_s_d_s[n * 18 + 5] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_d_s[n * 6 + 5]);
465                         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]);
466 
467                         PRIM_INT__p_s_d_s[n * 18 + 6] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 0]);
468                         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]);
469 
470                         PRIM_INT__p_s_d_s[n * 18 + 7] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 1]);
471                         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]);
472                         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]);
473 
474                         PRIM_INT__p_s_d_s[n * 18 + 8] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 2]);
475                         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]);
476 
477                         PRIM_INT__p_s_d_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 3]);
478                         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]);
479                         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]);
480 
481                         PRIM_INT__p_s_d_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 4]);
482                         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]);
483                         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]);
484 
485                         PRIM_INT__p_s_d_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_d_s[n * 6 + 5]);
486                         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]);
487 
488                         PRIM_INT__p_s_d_s[n * 18 + 12] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 0]);
489                         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]);
490 
491                         PRIM_INT__p_s_d_s[n * 18 + 13] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 1]);
492                         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]);
493 
494                         PRIM_INT__p_s_d_s[n * 18 + 14] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 2]);
495                         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]);
496                         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]);
497 
498                         PRIM_INT__p_s_d_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 3]);
499                         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]);
500 
501                         PRIM_INT__p_s_d_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 4]);
502                         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]);
503                         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]);
504 
505                         PRIM_INT__p_s_d_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_d_s[n * 6 + 5]);
506                         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]);
507                         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]);
508 
509                     }
510 
511 
512                     VRR_I_d_s_f_s(
513                             PRIM_INT__d_s_f_s,
514                             PRIM_INT__p_s_f_s,
515                             PRIM_INT__s_s_f_s,
516                             PRIM_INT__p_s_d_s,
517                             P_PA,
518                             a_over_p,
519                             aop_PQ,
520                             one_over_2p,
521                             one_over_2pq,
522                             4);
523 
524 
525                     ostei_general_vrr_I(3, 0, 4, 0, 3,
526                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
527                             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);
528 
529 
530 
531                     // Forming PRIM_INT__p_s_p_s[5 * 9];
532                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
533                     {
534 
535                         PRIM_INT__p_s_p_s[n * 9 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 0]);
536                         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]);
537                         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]);
538 
539                         PRIM_INT__p_s_p_s[n * 9 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 1]);
540                         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]);
541 
542                         PRIM_INT__p_s_p_s[n * 9 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_p_s[n * 3 + 2]);
543                         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]);
544 
545                         PRIM_INT__p_s_p_s[n * 9 + 3] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 0]);
546                         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]);
547 
548                         PRIM_INT__p_s_p_s[n * 9 + 4] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 1]);
549                         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]);
550                         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]);
551 
552                         PRIM_INT__p_s_p_s[n * 9 + 5] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_p_s[n * 3 + 2]);
553                         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]);
554 
555                         PRIM_INT__p_s_p_s[n * 9 + 6] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 0]);
556                         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]);
557 
558                         PRIM_INT__p_s_p_s[n * 9 + 7] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 1]);
559                         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]);
560 
561                         PRIM_INT__p_s_p_s[n * 9 + 8] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_p_s[n * 3 + 2]);
562                         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]);
563                         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]);
564 
565                     }
566 
567 
568                     VRR_I_d_s_d_s(
569                             PRIM_INT__d_s_d_s,
570                             PRIM_INT__p_s_d_s,
571                             PRIM_INT__s_s_d_s,
572                             PRIM_INT__p_s_p_s,
573                             P_PA,
574                             a_over_p,
575                             aop_PQ,
576                             one_over_2p,
577                             one_over_2pq,
578                             4);
579 
580 
581                     ostei_general_vrr_I(3, 0, 3, 0, 3,
582                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
583                             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);
584 
585 
586                     ostei_general_vrr_I(4, 0, 4, 0, 2,
587                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
588                             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);
589 
590 
591                     VRR_K_s_s_h_s(
592                             PRIM_INT__s_s_h_s,
593                             PRIM_INT__s_s_g_s,
594                             PRIM_INT__s_s_f_s,
595                             Q_PA,
596                             a_over_q,
597                             aoq_PQ,
598                             one_over_2q,
599                             9);
600 
601 
602                     ostei_general_vrr_I(1, 0, 5, 0, 5,
603                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
604                             PRIM_INT__s_s_h_s, NULL, NULL, PRIM_INT__s_s_g_s, NULL, PRIM_INT__p_s_h_s);
605 
606 
607                     ostei_general_vrr_I(2, 0, 5, 0, 4,
608                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
609                             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);
610 
611 
612                     ostei_general_vrr_I(3, 0, 5, 0, 3,
613                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
614                             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);
615 
616 
617                     ostei_general_vrr_I(4, 0, 5, 0, 2,
618                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
619                             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);
620 
621 
622 
623                     // Forming PRIM_INT__p_s_s_s[5 * 3];
624                     for(n = 0; n < 5; ++n)  // loop over orders of auxiliary function
625                     {
626 
627                         PRIM_INT__p_s_s_s[n * 3 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__s_s_s_s[n * 1 + 0]);
628                         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]);
629 
630                         PRIM_INT__p_s_s_s[n * 3 + 1] = SIMINT_MUL(P_PA[1], PRIM_INT__s_s_s_s[n * 1 + 0]);
631                         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]);
632 
633                         PRIM_INT__p_s_s_s[n * 3 + 2] = SIMINT_MUL(P_PA[2], PRIM_INT__s_s_s_s[n * 1 + 0]);
634                         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]);
635 
636                     }
637 
638 
639 
640                     // Forming PRIM_INT__d_s_p_s[4 * 18];
641                     for(n = 0; n < 4; ++n)  // loop over orders of auxiliary function
642                     {
643 
644                         PRIM_INT__d_s_p_s[n * 18 + 0] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 0]);
645                         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]);
646                         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]);
647                         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]);
648 
649                         PRIM_INT__d_s_p_s[n * 18 + 1] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 1]);
650                         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]);
651                         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]);
652 
653                         PRIM_INT__d_s_p_s[n * 18 + 2] = SIMINT_MUL(P_PA[0], PRIM_INT__p_s_p_s[n * 9 + 2]);
654                         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]);
655                         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]);
656 
657                         PRIM_INT__d_s_p_s[n * 18 + 9] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 3]);
658                         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]);
659                         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]);
660 
661                         PRIM_INT__d_s_p_s[n * 18 + 10] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 4]);
662                         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]);
663                         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]);
664                         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]);
665 
666                         PRIM_INT__d_s_p_s[n * 18 + 11] = SIMINT_MUL(P_PA[1], PRIM_INT__p_s_p_s[n * 9 + 5]);
667                         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]);
668                         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]);
669 
670                         PRIM_INT__d_s_p_s[n * 18 + 15] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 6]);
671                         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]);
672                         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]);
673 
674                         PRIM_INT__d_s_p_s[n * 18 + 16] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 7]);
675                         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]);
676                         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]);
677 
678                         PRIM_INT__d_s_p_s[n * 18 + 17] = SIMINT_MUL(P_PA[2], PRIM_INT__p_s_p_s[n * 9 + 8]);
679                         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]);
680                         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]);
681                         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]);
682 
683                     }
684 
685 
686                     VRR_I_f_s_d_s(
687                             PRIM_INT__f_s_d_s,
688                             PRIM_INT__d_s_d_s,
689                             PRIM_INT__p_s_d_s,
690                             PRIM_INT__d_s_p_s,
691                             P_PA,
692                             a_over_p,
693                             aop_PQ,
694                             one_over_2p,
695                             one_over_2pq,
696                             3);
697 
698 
699                     ostei_general_vrr_I(4, 0, 3, 0, 2,
700                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
701                             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);
702 
703 
704                     ostei_general_vrr_I(5, 0, 4, 0, 1,
705                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
706                             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);
707 
708 
709                     ostei_general_vrr1_K(6, 8,
710                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
711                             PRIM_INT__s_s_h_s, PRIM_INT__s_s_g_s, PRIM_INT__s_s_i_s);
712 
713 
714                     ostei_general_vrr_I(1, 0, 6, 0, 5,
715                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
716                             PRIM_INT__s_s_i_s, NULL, NULL, PRIM_INT__s_s_h_s, NULL, PRIM_INT__p_s_i_s);
717 
718 
719                     ostei_general_vrr_I(2, 0, 6, 0, 4,
720                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
721                             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);
722 
723 
724                     ostei_general_vrr_I(3, 0, 6, 0, 3,
725                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
726                             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);
727 
728 
729                     ostei_general_vrr_I(4, 0, 6, 0, 2,
730                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
731                             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);
732 
733 
734                     ostei_general_vrr_I(5, 0, 5, 0, 1,
735                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
736                             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);
737 
738 
739                     ostei_general_vrr1_K(7, 7,
740                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
741                             PRIM_INT__s_s_i_s, PRIM_INT__s_s_h_s, PRIM_INT__s_s_k_s);
742 
743 
744                     ostei_general_vrr_I(1, 0, 7, 0, 5,
745                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
746                             PRIM_INT__s_s_k_s, NULL, NULL, PRIM_INT__s_s_i_s, NULL, PRIM_INT__p_s_k_s);
747 
748 
749                     ostei_general_vrr_I(2, 0, 7, 0, 4,
750                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
751                             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);
752 
753 
754                     ostei_general_vrr_I(3, 0, 7, 0, 3,
755                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
756                             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);
757 
758 
759                     ostei_general_vrr_I(4, 0, 7, 0, 2,
760                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
761                             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);
762 
763 
764                     ostei_general_vrr_I(5, 0, 6, 0, 1,
765                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
766                             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);
767 
768 
769                     ostei_general_vrr1_K(8, 6,
770                             one_over_2q, a_over_q, aoq_PQ, Q_PA,
771                             PRIM_INT__s_s_k_s, PRIM_INT__s_s_i_s, PRIM_INT__s_s_l_s);
772 
773 
774                     ostei_general_vrr_I(1, 0, 8, 0, 5,
775                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
776                             PRIM_INT__s_s_l_s, NULL, NULL, PRIM_INT__s_s_k_s, NULL, PRIM_INT__p_s_l_s);
777 
778 
779                     ostei_general_vrr_I(2, 0, 8, 0, 4,
780                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
781                             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);
782 
783 
784                     ostei_general_vrr_I(3, 0, 8, 0, 3,
785                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
786                             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);
787 
788 
789                     ostei_general_vrr_I(4, 0, 8, 0, 2,
790                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
791                             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);
792 
793 
794                     ostei_general_vrr_I(5, 0, 7, 0, 1,
795                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
796                             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);
797 
798 
799                     ostei_general_vrr_I(5, 0, 8, 0, 1,
800                             one_over_2p, a_over_p, one_over_2pq, aop_PQ, P_PA,
801                             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);
802 
803 
804 
805 
806                     ////////////////////////////////////
807                     // Accumulate contracted integrals
808                     ////////////////////////////////////
809                     if(lastoffset == 0)
810                     {
811                         contract_all(225, PRIM_INT__g_s_g_s, PRIM_PTR_INT__g_s_g_s);
812                         contract_all(315, PRIM_INT__g_s_h_s, PRIM_PTR_INT__g_s_h_s);
813                         contract_all(420, PRIM_INT__g_s_i_s, PRIM_PTR_INT__g_s_i_s);
814                         contract_all(540, PRIM_INT__g_s_k_s, PRIM_PTR_INT__g_s_k_s);
815                         contract_all(675, PRIM_INT__g_s_l_s, PRIM_PTR_INT__g_s_l_s);
816                         contract_all(315, PRIM_INT__h_s_g_s, PRIM_PTR_INT__h_s_g_s);
817                         contract_all(441, PRIM_INT__h_s_h_s, PRIM_PTR_INT__h_s_h_s);
818                         contract_all(588, PRIM_INT__h_s_i_s, PRIM_PTR_INT__h_s_i_s);
819                         contract_all(756, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
820                         contract_all(945, PRIM_INT__h_s_l_s, PRIM_PTR_INT__h_s_l_s);
821                     }
822                     else
823                     {
824                         contract(225, shelloffsets, PRIM_INT__g_s_g_s, PRIM_PTR_INT__g_s_g_s);
825                         contract(315, shelloffsets, PRIM_INT__g_s_h_s, PRIM_PTR_INT__g_s_h_s);
826                         contract(420, shelloffsets, PRIM_INT__g_s_i_s, PRIM_PTR_INT__g_s_i_s);
827                         contract(540, shelloffsets, PRIM_INT__g_s_k_s, PRIM_PTR_INT__g_s_k_s);
828                         contract(675, shelloffsets, PRIM_INT__g_s_l_s, PRIM_PTR_INT__g_s_l_s);
829                         contract(315, shelloffsets, PRIM_INT__h_s_g_s, PRIM_PTR_INT__h_s_g_s);
830                         contract(441, shelloffsets, PRIM_INT__h_s_h_s, PRIM_PTR_INT__h_s_h_s);
831                         contract(588, shelloffsets, PRIM_INT__h_s_i_s, PRIM_PTR_INT__h_s_i_s);
832                         contract(756, shelloffsets, PRIM_INT__h_s_k_s, PRIM_PTR_INT__h_s_k_s);
833                         contract(945, shelloffsets, PRIM_INT__h_s_l_s, PRIM_PTR_INT__h_s_l_s);
834                         PRIM_PTR_INT__g_s_g_s += lastoffset*225;
835                         PRIM_PTR_INT__g_s_h_s += lastoffset*315;
836                         PRIM_PTR_INT__g_s_i_s += lastoffset*420;
837                         PRIM_PTR_INT__g_s_k_s += lastoffset*540;
838                         PRIM_PTR_INT__g_s_l_s += lastoffset*675;
839                         PRIM_PTR_INT__h_s_g_s += lastoffset*315;
840                         PRIM_PTR_INT__h_s_h_s += lastoffset*441;
841                         PRIM_PTR_INT__h_s_i_s += lastoffset*588;
842                         PRIM_PTR_INT__h_s_k_s += lastoffset*756;
843                         PRIM_PTR_INT__h_s_l_s += lastoffset*945;
844                     }
845 
846                 }  // close loop over j
847             }  // close loop over i
848 
849             //Advance to the next batch
850             jstart = SIMINT_SIMD_ROUND(jend);
851 
852             //////////////////////////////////////////////
853             // Contracted integrals: Horizontal recurrance
854             //////////////////////////////////////////////
855 
856 
857             const double hAB[3] = { P.AB_x[ab], P.AB_y[ab], P.AB_z[ab] };
858 
859 
860             for(abcd = 0; abcd < nshellbatch; ++abcd, ++real_abcd)
861             {
862                 const double hCD[3] = { Q.AB_x[cd+abcd], Q.AB_y[cd+abcd], Q.AB_z[cd+abcd] };
863 
864                 // set up HRR pointers
865                 double const * restrict HRR_INT__g_s_g_s = INT__g_s_g_s + abcd * 225;
866                 double const * restrict HRR_INT__g_s_h_s = INT__g_s_h_s + abcd * 315;
867                 double const * restrict HRR_INT__g_s_i_s = INT__g_s_i_s + abcd * 420;
868                 double const * restrict HRR_INT__g_s_k_s = INT__g_s_k_s + abcd * 540;
869                 double const * restrict HRR_INT__g_s_l_s = INT__g_s_l_s + abcd * 675;
870                 double const * restrict HRR_INT__h_s_g_s = INT__h_s_g_s + abcd * 315;
871                 double const * restrict HRR_INT__h_s_h_s = INT__h_s_h_s + abcd * 441;
872                 double const * restrict HRR_INT__h_s_i_s = INT__h_s_i_s + abcd * 588;
873                 double const * restrict HRR_INT__h_s_k_s = INT__h_s_k_s + abcd * 756;
874                 double const * restrict HRR_INT__h_s_l_s = INT__h_s_l_s + abcd * 945;
875                 double * restrict HRR_INT__g_p_g_g = INT__g_p_g_g + real_abcd * 10125;
876 
877                 // form INT__g_p_g_s
878                 HRR_J_g_p(
879                     HRR_INT__g_p_g_s,
880                     HRR_INT__g_s_g_s,
881                     HRR_INT__h_s_g_s,
882                     hAB, 15);
883 
884                 // form INT__g_p_h_s
885                 HRR_J_g_p(
886                     HRR_INT__g_p_h_s,
887                     HRR_INT__g_s_h_s,
888                     HRR_INT__h_s_h_s,
889                     hAB, 21);
890 
891                 // form INT__g_p_i_s
892                 HRR_J_g_p(
893                     HRR_INT__g_p_i_s,
894                     HRR_INT__g_s_i_s,
895                     HRR_INT__h_s_i_s,
896                     hAB, 28);
897 
898                 // form INT__g_p_k_s
899                 HRR_J_g_p(
900                     HRR_INT__g_p_k_s,
901                     HRR_INT__g_s_k_s,
902                     HRR_INT__h_s_k_s,
903                     hAB, 36);
904 
905                 // form INT__g_p_l_s
906                 HRR_J_g_p(
907                     HRR_INT__g_p_l_s,
908                     HRR_INT__g_s_l_s,
909                     HRR_INT__h_s_l_s,
910                     hAB, 45);
911 
912                 // form INT__g_p_g_p
913                 HRR_L_g_p(
914                     HRR_INT__g_p_g_p,
915                     HRR_INT__g_p_g_s,
916                     HRR_INT__g_p_h_s,
917                     hCD, 45);
918 
919                 // form INT__g_p_h_p
920                 ostei_general_hrr_L(4, 1, 5, 1, hCD, HRR_INT__g_p_i_s, HRR_INT__g_p_h_s, HRR_INT__g_p_h_p);
921 
922                 // form INT__g_p_i_p
923                 ostei_general_hrr_L(4, 1, 6, 1, hCD, HRR_INT__g_p_k_s, HRR_INT__g_p_i_s, HRR_INT__g_p_i_p);
924 
925                 // form INT__g_p_k_p
926                 ostei_general_hrr_L(4, 1, 7, 1, hCD, HRR_INT__g_p_l_s, HRR_INT__g_p_k_s, HRR_INT__g_p_k_p);
927 
928                 // form INT__g_p_g_d
929                 ostei_general_hrr_L(4, 1, 4, 2, hCD, HRR_INT__g_p_h_p, HRR_INT__g_p_g_p, HRR_INT__g_p_g_d);
930 
931                 // form INT__g_p_h_d
932                 ostei_general_hrr_L(4, 1, 5, 2, hCD, HRR_INT__g_p_i_p, HRR_INT__g_p_h_p, HRR_INT__g_p_h_d);
933 
934                 // form INT__g_p_i_d
935                 ostei_general_hrr_L(4, 1, 6, 2, hCD, HRR_INT__g_p_k_p, HRR_INT__g_p_i_p, HRR_INT__g_p_i_d);
936 
937                 // form INT__g_p_g_f
938                 ostei_general_hrr_L(4, 1, 4, 3, hCD, HRR_INT__g_p_h_d, HRR_INT__g_p_g_d, HRR_INT__g_p_g_f);
939 
940                 // form INT__g_p_h_f
941                 ostei_general_hrr_L(4, 1, 5, 3, hCD, HRR_INT__g_p_i_d, HRR_INT__g_p_h_d, HRR_INT__g_p_h_f);
942 
943                 // form INT__g_p_g_g
944                 ostei_general_hrr_L(4, 1, 4, 4, hCD, HRR_INT__g_p_h_f, HRR_INT__g_p_g_f, HRR_INT__g_p_g_g);
945 
946 
947             }  // close HRR loop
948 
949 
950         }   // close loop cdbatch
951 
952         istart = iend;
953     }  // close loop over ab
954 
955     return P.nshell12_clip * Q.nshell12_clip;
956 }
957 
ostei_p_g_g_g(struct simint_multi_shellpair const P,struct simint_multi_shellpair const Q,double screen_tol,double * const restrict work,double * const restrict INT__p_g_g_g)958 int ostei_p_g_g_g(struct simint_multi_shellpair const P,
959                   struct simint_multi_shellpair const Q,
960                   double screen_tol,
961                   double * const restrict work,
962                   double * const restrict INT__p_g_g_g)
963 {
964     double P_AB[3*P.nshell12];
965     struct simint_multi_shellpair P_tmp = P;
966     P_tmp.PA_x = P.PB_x;  P_tmp.PA_y = P.PB_y;  P_tmp.PA_z = P.PB_z;
967     P_tmp.PB_x = P.PA_x;  P_tmp.PB_y = P.PA_y;  P_tmp.PB_z = P.PA_z;
968     P_tmp.AB_x = P_AB;
969     P_tmp.AB_y = P_AB + P.nshell12;
970     P_tmp.AB_z = P_AB + 2*P.nshell12;
971 
972     for(int i = 0; i < P.nshell12; i++)
973     {
974         P_tmp.AB_x[i] = -P.AB_x[i];
975         P_tmp.AB_y[i] = -P.AB_y[i];
976         P_tmp.AB_z[i] = -P.AB_z[i];
977     }
978 
979     int ret = ostei_g_p_g_g(P_tmp, Q, screen_tol, work, INT__p_g_g_g);
980     double buffer[10125] SIMINT_ALIGN_ARRAY_DBL;
981 
982     for(int q = 0; q < ret; q++)
983     {
984         int idx = 0;
985         for(int a = 0; a < 3; ++a)
986         for(int b = 0; b < 15; ++b)
987         for(int c = 0; c < 15; ++c)
988         for(int d = 0; d < 15; ++d)
989             buffer[idx++] = INT__p_g_g_g[q*10125+b*675+a*225+c*15+d];
990 
991         memcpy(INT__p_g_g_g+q*10125, buffer, 10125*sizeof(double));
992     }
993 
994     return ret;
995 }
996 
997