Branch Coverage

inc/matrixssl-3-9-3-open/crypto/math/pstm.c
Criterion Covered Total %
branch 270 678 39.8


line true false branch
62 0 4504874 if (size > PSTM_MAX_SIZE)
67 0 4504874 if (a->dp == NULL)
76 77888063 4504874 for (x = 0; x < size; x++)
106 0 0 if (size > PSTM_MAX_SIZE)
111 0 0 if (a->alloc < size)
119 0 0 if (tmp == NULL)
129 0 0 for (; i < a->alloc; i++)
146 20874926 1512666 if (a == b)
151 0 1512666 if (b->alloc < a->used)
153 0 0 if ((res = pstm_grow(b, a->used)) != PSTM_OKAY)
169 13841864 1512666 for (n = 0; n < a->used; n++)
174 216 1512666 for (; n < b->used; n++)
192 0 35032 if (pstm_copy(a, b) != PSTM_OKAY)
211 114145083 67206 while (a->used > 0 && a->dp[a->used - 1] == 0)
29614458 84530625 while (a->used > 0 && a->dp[a->used - 1] == 0)
216 67206 84530625 if (a->used == 0)
231 4728708 0 if (a != NULL && a->dp != NULL)
4504874 223834 if (a != NULL && a->dp != NULL)
234 33309505 4504874 for (i = 0; i < a->used; i++)
255 1114087 0 if (mp0)
258 1114087 0 if (mp1)
261 4477 1109610 if (mp2)
264 0 4477 if (mp3)
267 0 0 if (mp4)
270 0 0 if (mp5)
273 0 0 if (mp6)
276 0 0 if (mp7)
302 8318613 915395 for (n = 0; n < a->alloc; n++)
318 461811 48033917 if (a->used > b->used)
322 552717 47481200 else if (a->used < b->used)
331 48059188 9111 for (n = 0; n < a->used; ++n, --tmpa, --tmpb)
333 19441004 28618184 if (*tmpa > *tmpb)
337 28031085 587099 else if (*tmpa < *tmpb)
352 0 15750603 if (a->sign != b->sign)
354 0 0 if (a->sign == PSTM_NEG)
364 0 15750603 if (a->sign == PSTM_NEG)
382 482016 6967019 if ((b && a->used == 0) || a->sign == PSTM_NEG)
482016 0 if ((b && a->used == 0) || a->sign == PSTM_NEG)
3549949 3899086 if ((b && a->used == 0) || a->sign == PSTM_NEG)
387 3858568 40518 if (a->used > 1)
392 38376 2142 if (a->dp[0] > b)
396 0 2142 else if (a->dp[0] < b)
504 0 21086 if (a->alloc < a->used)
506 0 0 if (pstm_grow(a, a->used) != PSTM_OKAY)
512 2821514 21086 for (; len > 0; len--)
514 0 2821514 if (pstm_mul_2d(a, 8, a) != PSTM_OKAY)
537 7686 0 if (len < 1 || *(p++) != ASN_INTEGER ||
538 0 7556 getAsnLength(&p, len - 1, &vlen) < 0 || (len - 1) < vlen)
543 0 7556 if (pstm_init_for_read_unsigned_bin(pool, a, vlen) != PSTM_OKAY)
547 0 7556 if (pstm_read_unsigned_bin(a, p, vlen) != 0)
574 0 862516 if (pstm_init_size(pool, &tmp, sizeof(pstm_digit)) != PSTM_OKAY)
610 6665 0 if (radix < 2 || radix > 64)
0 6665 if (radix < 2 || radix > 64)
616 0 6665 if (*buf == '-')
630 868964 217 while (len > 0)
636 868964 0 ch = ((radix < 36) ?
639 11823828 6448 for (y = 0; y < 64; y++)
641 862516 10961312 if (ch == pstm_s_rmap[y])
651 862516 6448 if (y < radix)
664 6665 0 if (pstm_iszero(a) != PS_TRUE)
679 0 67007 if (a->used == 0)
689 2314691 67007 while (q > ((pstm_digit) 0))
727 0 0 if (b >= a->used)
733 0 0 for (y = 0; y < a->used - b; y++)
738 0 0 for (; y < a->used; y++)
759 0 24330 if (b <= 0)
764 0 24330 if (a->alloc < a->used + b)
766 0 0 if ((res = pstm_grow(a, a->used + b)) != PSTM_OKAY)
784 145017 24330 for (x = a->used - 1; x >= b; x--)
790 241384 24330 for (x = 0; x < b; x++)
809 0 2142 if (b < 0)
815 0 2142 if (z >= PSTM_MAX_SIZE)
823 0 2142 if (a->used > a->alloc)
825 0 0 if (pstm_grow(a, a->used) != PSTM_OKAY)
847 0 119842 if (b->alloc < a->used + 1)
849 0 0 if ((res = pstm_grow(b, a->used + 1)) != PSTM_OKAY)
868 136968 119842 for (x = 0; x < a->used; x++)
885 2 119840 if (r != 0 && b->used != (PSTM_MAX_SIZE - 1))
2 0 if (r != 0 && b->used != (PSTM_MAX_SIZE - 1))
893 0 119842 for (x = b->used; x < oldused; x++)
913 0 19931689 if (b->used > a->used)
917 0 19931689 if (c->alloc < a->used)
919 0 0 if ((x = pstm_grow(c, a->used)) != PSTM_OKAY)
928 211010547 19931689 for (x = 0; x < oldbused; x++)
934 1066850 19931689 for (; x < a->used; x++)
940 26902 19931689 for (; x < oldused; x++)
965 34356 13000273 if (b->used > y)
972 0 13034629 if (c->used > c->alloc)
974 0 0 if (pstm_grow(c, c->used) != PSTM_OKAY)
981 125034144 13034629 for (x = 0; x < y; x++)
983 0 125034144 if (a->used <= x)
991 26528141 98506003 if (b->used <= x)
1003 8582 13026047 if (t != 0 && x < PSTM_MAX_SIZE)
8582 0 if (t != 0 && x < PSTM_MAX_SIZE)
1005 0 8582 if (c->used == c->alloc)
1007 0 0 if (pstm_grow(c, c->alloc + 1) != PSTM_OKAY)
1017 1987 13034629 for (; x < oldused; x++)
1039 844043 16370926 if (sa != sb)
1046 0 844043 if ((res = s_pstm_add(a, b, c)) != PSTM_OKAY)
1057 12150510 4220416 if (pstm_cmp_mag(a, b) != PSTM_LT)
1062 0 12150510 if ((res = pstm_sub_s(a, b, c)) != PSTM_OKAY)
1072 0 4220416 if ((res = pstm_sub_s(b, a, c)) != PSTM_OKAY)
1091 0 0 if (pstm_init_size(pool, &tmp, sizeof(pstm_digit)) != PSTM_OKAY)
1118 0 2142 if ((b & 1) == 0)
1148 2 2140 if (!bits)
1154 2142 0 if (b->used > 1)
1156 0 2142 if ((x = pstm_2expt(a, (b->used - 1) * DIGIT_BIT + bits - 1)) !=
1168 119842 2142 for (x = bits - 1; x < (uint16_t) DIGIT_BIT; x++)
1170 0 119842 if (pstm_mul_2(a, a) != PSTM_OKAY)
1174 2142 117700 if (pstm_cmp_mag(a, b) != PSTM_LT)
1176 0 2142 if (pstm_sub_s(a, b, a) != PSTM_OKAY)
1195 0 2854404 if (pstm_copy(a, c) != PSTM_OKAY)
1201 24330 2830074 if (b >= DIGIT_BIT)
1203 0 24330 if (pstm_lshd(c, b / DIGIT_BIT) != PSTM_OKAY)
1211 2854292 112 if (b != 0)
1215 43300552 2854292 for (x = 0; x < c->used; x++)
1222 3656 2850636 if (carry && x < PSTM_MAX_SIZE)
3656 0 if (carry && x < PSTM_MAX_SIZE)
1224 0 3656 if (c->used == c->alloc)
1226 0 0 if (pstm_grow(c, c->alloc + 1) != PSTM_OKAY)
1247 0 0 if (b <= 0)
1254 0 0 if (pstm_copy(a, c) != PSTM_OKAY)
1260 0 0 if (b >= (DIGIT_BIT * a->used))
1266 0 0 for (x = (b / DIGIT_BIT) + ((b % DIGIT_BIT) == 0 ? 0 : 1); x < c->used; x++)
1287 0 862516 if (c->alloc < a->used + 1)
1289 0 0 if ((res = pstm_grow(c, a->used + 1)) != PSTM_OKAY)
1298 3877764 862516 for (x = 0; x < a->used; x++)
1304 52615 809901 if (w != 0 && (a->used != PSTM_MAX_SIZE))
52615 0 if (w != 0 && (a->used != PSTM_MAX_SIZE))
1309 0 862516 for (; x < oldused; x++)
1335 0 18020522 if (b <= 0)
1337 0 0 if (pstm_copy(a, c) != PSTM_OKAY)
1341 0 0 if (d != NULL)
1348 0 18020522 if (pstm_copy(a, c) != PSTM_OKAY)
1355 0 18020522 if (b >= (int16_t) DIGIT_BIT)
1362 18020522 0 if (D != 0)
1377 215007522 18020522 for (x = c->used - 1; x >= 0; x--)
1395 0 18020522 if (d != NULL)
1397 0 0 if (pstm_mod_2d(a, b, d) != PSTM_OKAY)
1414 0 4492121 if (b->alloc < a->used)
1416 0 0 if (pstm_grow(b, a->used) != PSTM_OKAY)
1434 32648944 4492121 for (x = b->used - 1; x >= 0; x--)
1448 0 4492121 for (x = b->used; x < oldused; x++)
1468 0 27302 if (a == b)
1474 0 27302 if (toSqr)
1481 0 0 if ((b->used * 2) + 2 >= x)
1486 0 27302 if ((res = pstm_init_size(pool, a, x)) != PSTM_OKAY)
1592 0 18587 if (pstm_iszero(b) == PSTM_YES)
1598 2142 16445 if (pstm_cmp_mag(a, b) == PSTM_LT)
1600 2142 0 if (d != NULL)
1608 0 2142 if (c != NULL)
1617 0 16445 if (res != PSTM_OKAY)
1622 0 16445 if (res != PSTM_OKAY)
1628 0 16445 if (res != PSTM_OKAY)
1635 0 16445 if (res != PSTM_OKAY)
1645 16445 0 if (((res = pstm_abs(a, &ta)) != PSTM_OKAY) ||
16445 0 if (((res = pstm_abs(a, &ta)) != PSTM_OKAY) ||
1646 16445 0 ((res = pstm_abs(b, &tb)) != PSTM_OKAY) ||
1647 16445 0 ((res = pstm_mul_2d(&tb, n, &tb)) != PSTM_OKAY) ||
1653 8222175 16445 while (n-- >= 0)
1655 4171808 4050367 if (pstm_cmp(&tb, &ta) != PSTM_GT)
1657 4171808 0 if (((res = pstm_sub(&ta, &tb, &ta)) != PSTM_OKAY) ||
4171808 0 if (((res = pstm_sub(&ta, &tb, &ta)) != PSTM_OKAY) ||
1663 8222175 0 if (((res = pstm_div_2d(pool, &tb, 1, &tb, NULL)) !=
1664 8222175 0 PSTM_OKAY) ||
1675 0 16445 if (c != NULL)
1678 0 0 c->sign = (pstm_iszero(c) == PSTM_YES) ? PSTM_ZPOS : n2;
1680 16445 0 if (d != NULL)
1683 16445 0 d->sign = (pstm_iszero(d) == PSTM_YES) ? PSTM_ZPOS : n;
1981 0 18587 if ((err = pstm_init_size(pool, &t, b->alloc)) != PSTM_OKAY)
1985 0 18587 if ((err = pstm_div(pool, a, b, NULL, &t)) != PSTM_OKAY)
1990 1620 16967 if (t.sign != b->sign)
2020 1147 6426 if ((a == d) && (size < a->alloc))
1147 0 if ((a == d) && (size < a->alloc))
2024 0 7573 if ((res = pstm_init_size(pool, &tmp, size)) != PSTM_OKAY)
2028 0 7573 if ((res = pstm_mul_comba(pool, a, b, &tmp, NULL, 0)) != PSTM_OKAY)
2056 5648 0 switch (x)
2070 5648 0 if (P->dp[0] & 1)
2079 3354 2294 if (G->used <= P->used)
2088 0 2294 if ((err = pstm_init_size(pool, &tmp_int, P->used)) != PSTM_OKAY)
2096 0 2294 if (err != PSTM_OKAY)
2104 0 5648 if (Y->used > Y->alloc)
2106 0 0 if (pstm_grow(Y, Y->used) != PSTM_OKAY)
2130 0 0 if (x < 50)
2140 0 0 if ((err = pstm_montgomery_setup(P, &mp)) != PSTM_OKAY)
2146 0 0 if ((err = pstm_init_size(pool, &res, (P->used * 2) + 1)) != PSTM_OKAY)
2156 0 0 if ((err = pstm_montgomery_calc_normalization(&res, P)) != PSTM_OKAY)
2164 0 0 if ((err = pstm_init_size(pool, &M[1], res.used)) != PSTM_OKAY)
2170 0 0 if (pstm_cmp_mag(P, G) != PSTM_GT)
2173 0 0 if ((err = pstm_mod(pool, G, P, &M[1])) != PSTM_OKAY)
2180 0 0 if ((err = pstm_copy(G, &M[1])) != PSTM_OKAY)
2185 0 0 if ((err = pstm_mulmod(pool, &M[1], &res, P, &M[1])) != PSTM_OKAY)
2191 0 0 if ((paD = psMalloc(pool, paDlen)) == NULL)
2197 0 0 if (pstm_init_copy(pool, &M[1 << (winsize - 1)], &M[1], 1) != PSTM_OKAY)
2202 0 0 for (x = 0; x < (winsize - 1); x++)
2204 0 0 if ((err = pstm_sqr_comba(pool, &M[1 << (winsize - 1)],
2209 0 0 if ((err = pstm_montgomery_reduce(pool, &M[1 << (winsize - 1)], P, mp,
2216 0 0 for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++)
2218 0 0 if ((err = pstm_init_size(pool, &M[x], M[1 << (winsize - 1)].alloc + 1))
2221 0 0 for (y = 1 << (winsize - 1); y < x; y++)
2230 0 0 for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++)
2232 0 0 if ((err = pstm_mul_comba(pool, &M[x - 1], &M[1], &M[x], paD, paDlen))
2237 0 0 if ((err = pstm_montgomery_reduce(pool, &M[x], P, mp, paD, paDlen)) !=
2255 0 0 if (--bitcnt == 0)
2258 0 0 if (digidx == -1)
2276 0 0 if (mode == 0 && y == 0)
0 0 if (mode == 0 && y == 0)
2282 0 0 if (mode == 1 && y == 0)
0 0 if (mode == 1 && y == 0)
2284 0 0 if ((err = pstm_sqr_comba(pool, &res, &res, paD, paDlen)) !=
2289 0 0 if ((err = pstm_montgomery_reduce(pool, &res, P, mp, paD, paDlen))
2301 0 0 if (bitcpy == winsize)
2304 0 0 for (x = 0; x < winsize; x++)
2306 0 0 if ((err = pstm_sqr_comba(pool, &res, &res, paD, paDlen)) !=
2311 0 0 if ((err = pstm_montgomery_reduce(pool, &res, P, mp, paD,
2319 0 0 if ((err = pstm_mul_comba(pool, &res, &M[bitbuf], &res, paD,
2324 0 0 if ((err = pstm_montgomery_reduce(pool, &res, P, mp, paD, paDlen))
2338 0 0 if (mode == 2 && bitcpy > 0)
0 0 if (mode == 2 && bitcpy > 0)
2341 0 0 for (x = 0; x < bitcpy; x++)
2343 0 0 if ((err = pstm_sqr_comba(pool, &res, &res, paD, paDlen)) !=
2348 0 0 if ((err = pstm_montgomery_reduce(pool, &res, P, mp, paD, paDlen))
2356 0 0 if ((bitbuf & (1 << winsize)) != 0)
2359 0 0 if ((err = pstm_mul_comba(pool, &res, &M[1], &res, paD, paDlen))
2364 0 0 if ((err = pstm_montgomery_reduce(pool, &res, P, mp, paD,
2377 0 0 if ((err = pstm_montgomery_reduce(pool, &res, P, mp, paD, paDlen)) !=
2383 0 0 if ((err = pstm_copy(&res, Y)) != PSTM_OKAY)
2389 0 0 for (x = 1 << (winsize - 1); x < (1 << winsize); x++)
2415 12190586 3556920 if (sa == sb)
2419 0 12190586 if ((res = s_pstm_add(a, b, c)) != PSTM_OKAY)
2431 3553695 3225 if (pstm_cmp_mag(a, b) == PSTM_LT)
2434 0 3553695 if ((res = pstm_sub_s(b, a, c)) != PSTM_OKAY)
2442 0 3225 if ((res = pstm_sub_s(a, b, c)) != PSTM_OKAY)
2462 0 0 if ((res = pstm_init_copy(pool, &t, a, 0)) != PSTM_OKAY)
2468 0 0 while (pstm_iszero(&t) == 0)
2471 0 0 if ((res = pstm_div_2d(pool, &t, 8, &t, NULL)) != PSTM_OKAY)
2490 0 11040 if (len == 0)
2496 784327 11040 while (ix < iy)
2518 0 11040 if ((res = pstm_init_copy(pool, &t, a, 0)) != PSTM_OKAY)
2523 1576172 11040 while (pstm_iszero(&t) == 0)
2526 0 1576172 if ((res = pstm_div_2d(pool, &t, 8, &t, NULL)) != PSTM_OKAY)
2555 0 0 if (b->sign == PSTM_NEG || pstm_iszero(b) == 1)
0 0 if (b->sign == PSTM_NEG || pstm_iszero(b) == 1)
2561 0 0 if (pstm_init_size(pool, &x, b->used) != PSTM_OKAY)
2567 0 0 if ((res = pstm_mod(pool, a, b, &x)) != PSTM_OKAY)
2572 0 0 if (pstm_init_copy(pool, &y, b, 0) != PSTM_OKAY)
2578 0 0 if (pstm_iseven(&x) == 1 && pstm_iseven(&y) == 1)
0 0 if (pstm_iseven(&x) == 1 && pstm_iseven(&y) == 1)
0 0 if (pstm_iseven(&x) == 1 && pstm_iseven(&y) == 1)
0 0 if (pstm_iseven(&x) == 1 && pstm_iseven(&y) == 1)
0 0 if (pstm_iseven(&x) == 1 && pstm_iseven(&y) == 1)
0 0 if (pstm_iseven(&x) == 1 && pstm_iseven(&y) == 1)
2585 0 0 if ((res = pstm_init_copy(pool, &u, &x, 0)) != PSTM_OKAY)
2589 0 0 if ((res = pstm_init_copy(pool, &v, &y, 0)) != PSTM_OKAY)
2594 0 0 if ((res = pstm_init_size(pool, &A, sizeof(pstm_digit))) != PSTM_OKAY)
2599 0 0 if ((res = pstm_init_size(pool, &D, sizeof(pstm_digit))) != PSTM_OKAY)
2606 0 0 if ((res = pstm_init(pool, &B)) != PSTM_OKAY)
2610 0 0 if ((res = pstm_init(pool, &C)) != PSTM_OKAY)
2617 0 0 while (pstm_iseven(&u) == 1)
0 0 while (pstm_iseven(&u) == 1)
0 0 while (pstm_iseven(&u) == 1)
2620 0 0 if ((res = pstm_div_2(&u, &u)) != PSTM_OKAY)
2626 0 0 if (pstm_isodd(&A) == 1 || pstm_isodd(&B) == 1)
0 0 if (pstm_isodd(&A) == 1 || pstm_isodd(&B) == 1)
0 0 if (pstm_isodd(&A) == 1 || pstm_isodd(&B) == 1)
0 0 if (pstm_isodd(&A) == 1 || pstm_isodd(&B) == 1)
0 0 if (pstm_isodd(&A) == 1 || pstm_isodd(&B) == 1)
0 0 if (pstm_isodd(&A) == 1 || pstm_isodd(&B) == 1)
2629 0 0 if ((res = pstm_add(&A, &y, &A)) != PSTM_OKAY)
2633 0 0 if ((res = pstm_sub(&B, &x, &B)) != PSTM_OKAY)
2639 0 0 if ((res = pstm_div_2(&A, &A)) != PSTM_OKAY)
2643 0 0 if ((res = pstm_div_2(&B, &B)) != PSTM_OKAY)
2650 0 0 while (pstm_iseven(&v) == 1)
0 0 while (pstm_iseven(&v) == 1)
0 0 while (pstm_iseven(&v) == 1)
2653 0 0 if ((res = pstm_div_2(&v, &v)) != PSTM_OKAY)
2659 0 0 if (pstm_isodd(&C) == 1 || pstm_isodd(&D) == 1)
0 0 if (pstm_isodd(&C) == 1 || pstm_isodd(&D) == 1)
0 0 if (pstm_isodd(&C) == 1 || pstm_isodd(&D) == 1)
0 0 if (pstm_isodd(&C) == 1 || pstm_isodd(&D) == 1)
0 0 if (pstm_isodd(&C) == 1 || pstm_isodd(&D) == 1)
0 0 if (pstm_isodd(&C) == 1 || pstm_isodd(&D) == 1)
2662 0 0 if ((res = pstm_add(&C, &y, &C)) != PSTM_OKAY)
2666 0 0 if ((res = pstm_sub(&D, &x, &D)) != PSTM_OKAY)
2672 0 0 if ((res = pstm_div_2(&C, &C)) != PSTM_OKAY)
2676 0 0 if ((res = pstm_div_2(&D, &D)) != PSTM_OKAY)
2683 0 0 if (pstm_cmp(&u, &v) != PSTM_LT)
2686 0 0 if ((res = pstm_sub(&u, &v, &u)) != PSTM_OKAY)
2690 0 0 if ((res = pstm_sub(&A, &C, &A)) != PSTM_OKAY)
2694 0 0 if ((res = pstm_sub(&B, &D, &B)) != PSTM_OKAY)
2702 0 0 if ((res = pstm_sub(&v, &u, &v)) != PSTM_OKAY)
2706 0 0 if ((res = pstm_sub(&C, &A, &C)) != PSTM_OKAY)
2710 0 0 if ((res = pstm_sub(&D, &B, &D)) != PSTM_OKAY)
2717 0 0 if (pstm_iszero(&u) == 0)
2725 0 0 if (pstm_cmp_d(&v, 1) != PSTM_EQ)
2732 0 0 while (pstm_cmp_d(&C, 0) == PSTM_LT)
2734 0 0 if ((res = pstm_add(&C, b, &C)) != PSTM_OKAY)
2741 0 0 while (pstm_cmp_mag(&C, b) != PSTM_LT)
2743 0 0 if ((res = pstm_sub(&C, b, &C)) != PSTM_OKAY)
2750 0 0 if ((res = pstm_copy(&C, c)) != PSTM_OKAY)
2780 2142 0 if (pstm_iseven(b) == 1)
0 2142 if (pstm_iseven(b) == 1)
0 2142 if (pstm_iseven(b) == 1)
2786 0 2142 if ((res = pstm_init_copy(pool, &x, b, 0)) != PSTM_OKAY)
2791 0 2142 if ((res = pstm_init_size(pool, &y, a->alloc)) != PSTM_OKAY)
2797 0 2142 if ((res = pstm_abs(a, &y)) != PSTM_OKAY)
2803 0 2142 if ((res = pstm_init_copy(pool, &u, &x, 0)) != PSTM_OKAY)
2807 0 2142 if ((res = pstm_init_copy(pool, &v, &y, 0)) != PSTM_OKAY)
2811 0 2142 if ((res = pstm_init(pool, &B)) != PSTM_OKAY)
2815 0 2142 if ((res = pstm_init(pool, &D)) != PSTM_OKAY)
2825 1554535 0 while (pstm_iseven(&u) == 1)
766013 788522 while (pstm_iseven(&u) == 1)
766013 788522 while (pstm_iseven(&u) == 1)
2828 0 766013 if ((res = pstm_div_2(&u, &u)) != PSTM_OKAY)
2834 766013 0 if (pstm_isodd(&B) == 1)
387295 378718 if (pstm_isodd(&B) == 1)
387295 378718 if (pstm_isodd(&B) == 1)
2836 0 387295 if ((res = pstm_sub(&B, &x, &B)) != PSTM_OKAY)
2842 0 766013 if ((res = pstm_div_2(&B, &B)) != PSTM_OKAY)
2849 1595976 0 while (pstm_iseven(&v) == 1)
807454 788522 while (pstm_iseven(&v) == 1)
807454 788522 while (pstm_iseven(&v) == 1)
2852 0 807454 if ((res = pstm_div_2(&v, &v)) != PSTM_OKAY)
2857 807454 0 if (pstm_isodd(&D) == 1)
685670 121784 if (pstm_isodd(&D) == 1)
685670 121784 if (pstm_isodd(&D) == 1)
2860 0 685670 if ((res = pstm_sub(&D, &x, &D)) != PSTM_OKAY)
2866 0 807454 if ((res = pstm_div_2(&D, &D)) != PSTM_OKAY)
2873 390805 397717 if (pstm_cmp(&u, &v) != PSTM_LT)
2876 0 390805 if ((res = pstm_sub(&u, &v, &u)) != PSTM_OKAY)
2880 0 390805 if ((res = pstm_sub(&B, &D, &B)) != PSTM_OKAY)
2888 0 397717 if ((res = pstm_sub(&v, &u, &v)) != PSTM_OKAY)
2892 0 397717 if ((res = pstm_sub(&D, &B, &D)) != PSTM_OKAY)
2899 0 788522 if (sanity++ > 4096)
2904 786380 2142 if (pstm_iszero(&u) == 0)
2912 0 2142 if (pstm_cmp_d(&v, 1) != PSTM_EQ)
2920 2126 2142 while (D.sign == PSTM_NEG)
2922 0 2126 if ((res = pstm_add(&D, b, &D)) != PSTM_OKAY)
2927 0 2142 if ((res = pstm_copy(&D, c)) != PSTM_OKAY)