text:
int_rules_1_2_1_4 = @theory begin

    #= ::Subsection::Closed:: =#
    #= 1.2.1.4*(d+e*x)^m*(f+g*x)^n*(a+b*x+c*x^2)^p =#
    @apply_utils Antiderivative((~x) ^ ~(m') * (~f + ~(g') * ~x) ^ ~(n') * (~(b') * ~x + ~(c') * (~x) ^ 2), ~x) => (~c * (~x) ^ (~m + 2) * (~f + ~g * ~x) ^ (~n + 1)) / (~g * (~m + ~n + 3)) <-- FreeQ([~b, ~c, ~f, ~g, ~m, ~n], ~x) && (EqQ(~c * ~f * (~m + 2) - ~b * ~g * (~m + ~n + 3), 0) && NeQ(~m + ~n + 3, 0))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~a + ~b * ~x + ~c * (~x) ^ 2) ^ FracPart(~p) / ((~c) ^ IntPart(~p) * (~b / 2 + ~c * ~x) ^ (2 * FracPart(~p)))) * Antiderivative((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~b / 2 + ~c * ~x) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && Not(IntegerQ(~p))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => Antiderivative((~d + ~e * ~x) ^ (~m + ~p) * (~f + ~g * ~x) ^ ~n * (~a / ~d + (~c / ~e) * ~x) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IntegerQ(~p) && Not(IGtQ(~n, 0))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => Antiderivative((~d + ~e * ~x) ^ (~m + ~p) * (~f + ~g * ~x) ^ ~n * (~a / ~d + (~c / ~e) * ~x) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~n], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IntegerQ(~p) || GtQ(~a, 0) && (GtQ(~d, 0) && EqQ(~m + ~p, 0)))))
    @apply_utils Antiderivative(((~x) ^ ~(n') * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p) / (~d + ~(e') * ~x), ~x) => Antiderivative((~x) ^ ~n * (~a / ~d + (~c * ~x) / ~e) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p - 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~n, ~p], ~x) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (Not(IntegerQ(~n)) || (Not(IntegerQ(2 * ~p)) || (IGtQ(~n, 2) || GtQ(~p, 0) && NeQ(~n, 2)))))))
    @apply_utils Antiderivative(((~x) ^ ~(n') * (~a + ~(c') * (~x) ^ 2) ^ ~p) / (~d + ~(e') * ~x), ~x) => Antiderivative((~x) ^ ~n * (~a / ~d + (~c * ~x) / ~e) * (~a + ~c * (~x) ^ 2) ^ (~p - 1), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~n, ~p], ~x) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (Not(IntegerQ(~n)) || (Not(IntegerQ(2 * ~p)) || (IGtQ(~n, 2) || GtQ(~p, 0) && NeQ(~n, 2))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => Antiderivative((~a / ~d + (~c * ~x) / ~e) ^ -(~m) * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~m + ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (ILtQ(~m, 0) && (IntegerQ(~n) && (LtQ(~n, 0) || GtQ(~p, 0))))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~d) ^ (2 * ~m) / (~a) ^ ~m) * Antiderivative(((~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ (~m + ~p)) / (~d - ~e * ~x) ^ ~m, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~f, 0) && (ILtQ(~m, -1) && Not(IGtQ(~n, 0) && (ILtQ(~m + ~n, 0) && Not(GtQ(~p, 1)))))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~f + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~d) ^ (2 * ~m) / (~a) ^ ~m) * Antiderivative(((~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ (~m + ~p)) / (~d - ~e * ~x) ^ ~m, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (ILtQ(~m, 0) && IntegerQ(~n)))))
    @apply_utils Antiderivative(((~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p) / (~d + ~(e') * ~x), ~x) => (-((2 * ~c * ~d - ~b * ~e)) * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / (~e * ~p * ((~b) ^ 2 - 4 * ~a * ~c) * (~d + ~e * ~x)) - (1 / (~d * ~e * ~p * ((~b) ^ 2 - 4 * ~a * ~c))) * Antiderivative((~f + ~g * ~x) ^ (~n - 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p * Simp((~b * (~a * ~e * ~g * ~n - ~c * ~d * ~f * (2 * ~p + 1)) - 2 * ~a * ~c * (~d * ~g * ~n - ~e * ~f * (2 * ~p + 1))) - ~c * ~g * (~b * ~d - 2 * ~a * ~e) * (~n + 2 * ~p + 1) * ~x, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (IGtQ(~n, 0) && ILtQ(~n + 2 * ~p, 0))))))
    @apply_utils Antiderivative(((~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p) / (~d + ~(e') * ~x), ~x) => (~d * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (2 * ~a * ~e * ~p * (~d + ~e * ~x)) - (1 / (2 * ~d * ~e * ~p)) * Antiderivative((~f + ~g * ~x) ^ (~n - 1) * (~a + ~c * (~x) ^ 2) ^ ~p * Simp((~d * ~g * ~n - ~e * ~f * (2 * ~p + 1)) - ~e * ~g * (~n + 2 * ~p + 1) * ~x, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (IGtQ(~n, 0) && ILtQ(~n + 2 * ~p, 0)))))
    @apply_utils Antiderivative(((~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p) / (~d + ~(e') * ~x), ~x) => ((~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p * ((~c * ~d - ~b * ~e) - ~c * ~e * ~x)) / (~p * (2 * ~c * ~d - ~b * ~e) * (~e * ~f - ~d * ~g)) + (1 / (~p * (2 * ~c * ~d - ~b * ~e) * (~e * ~f - ~d * ~g))) * Antiderivative((~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p * (((~b * ~e * ~g * (~n + ~p + 1) + ~c * ~e * ~f * (2 * ~p + 1)) - ~c * ~d * ~g * (~n + 2 * ~p + 1)) + ~c * ~e * ~g * (~n + 2 * ~p + 2) * ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (ILtQ(~n, 0) && (ILtQ(~n + 2 * ~p, 0) && Not(IGtQ(~n, 0))))))))
    @apply_utils Antiderivative(((~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p) / (~d + ~(e') * ~x), ~x) => (~d * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (2 * ~a * ~p * (~e * ~f - ~d * ~g) * (~d + ~e * ~x)) + (1 / (~p * (2 * ~c * ~d) * (~e * ~f - ~d * ~g))) * Antiderivative((~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ ~p * ((~c * ~e * ~f * (2 * ~p + 1) - ~c * ~d * ~g * (~n + 2 * ~p + 1)) + ~c * ~e * ~g * (~n + 2 * ~p + 2) * ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (ILtQ(~n, 0) && (ILtQ(~n + 2 * ~p, 0) && Not(IGtQ(~n, 0)))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (-(~e) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * ((~m - ~n) - 1)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (EqQ((~c * ~e * ~f + ~c * ~d * ~g) - ~b * ~e * ~g, 0) && NeQ((~m - ~n) - 1, 0)))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (-(~e) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * ((~m - ~n) - 1)) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (EqQ(~e * ~f + ~d * ~g, 0) && NeQ((~m - ~n) - 1, 0))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (-((~e) ^ 2) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / ((~n + 1) * ((~c * ~e * ~f + ~c * ~d * ~g) - ~b * ~e * ~g)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && EqQ((~m - ~n) - 2, 0))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (-((~e) ^ 2) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * (~n + 1) * (~e * ~f + ~d * ~g)) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && EqQ((~m - ~n) - 2, 0)))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p) / (~g * (~n + 1)) + ((~c * ~m) / (~e * ~g * (~n + 1))) * Antiderivative((~d + ~e * ~x) ^ (~m + 1) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p - 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (GtQ(~p, 0) && (LtQ(~n, -1) && Not(IntegerQ(~n + ~p) && LeQ(~n + ~p + 2, 0)))))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ ~p) / (~g * (~n + 1)) + ((~c * ~m) / (~e * ~g * (~n + 1))) * Antiderivative((~d + ~e * ~x) ^ (~m + 1) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ (~p - 1), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (GtQ(~p, 0) && (LtQ(~n, -1) && Not(IntegerQ(~n + ~p) && LeQ(~n + ~p + 2, 0))))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (-((~d + ~e * ~x) ^ ~m) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p) / (~g * ((~m - ~n) - 1)) - ((~m * ((~c * ~e * ~f + ~c * ~d * ~g) - ~b * ~e * ~g)) / ((~e) ^ 2 * ~g * ((~m - ~n) - 1))) * Antiderivative((~d + ~e * ~x) ^ (~m + 1) * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p - 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~n], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (GtQ(~p, 0) && (NeQ((~m - ~n) - 1, 0) && (Not(IGtQ(~n, 0)) && (Not(IntegerQ(~n + ~p) && LtQ(~n + ~p + 2, 0)) && RationalQ(~n))))))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (-((~d + ~e * ~x) ^ ~m) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ ~p) / (~g * ((~m - ~n) - 1)) - ((~c * ~m * (~e * ~f + ~d * ~g)) / ((~e) ^ 2 * ~g * ((~m - ~n) - 1))) * Antiderivative((~d + ~e * ~x) ^ (~m + 1) * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ (~p - 1), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~n], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (GtQ(~p, 0) && (NeQ((~m - ~n) - 1, 0) && (Not(IGtQ(~n, 0)) && (Not(IntegerQ(~n + ~p) && LtQ(~n + ~p + 2, 0)) && RationalQ(~n)))))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (~e * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * (~p + 1)) - ((~e * ~g * ~n) / (~c * (~p + 1))) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n - 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (LtQ(~p, -1) && GtQ(~n, 0)))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (~e * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * (~p + 1)) - ((~e * ~g * ~n) / (~c * (~p + 1))) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n - 1) * (~a + ~c * (~x) ^ 2) ^ (~p + 1), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (LtQ(~p, -1) && GtQ(~n, 0))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~e) ^ 2 * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / ((~p + 1) * ((~c * ~e * ~f + ~c * ~d * ~g) - ~b * ~e * ~g)) + (((~e) ^ 2 * ~g * ((~m - ~n) - 2)) / ((~p + 1) * ((~c * ~e * ~f + ~c * ~d * ~g) - ~b * ~e * ~g))) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~n], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (LtQ(~p, -1) && RationalQ(~n)))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~e) ^ 2 * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * (~p + 1) * (~e * ~f + ~d * ~g)) + (((~e) ^ 2 * ~g * ((~m - ~n) - 2)) / (~c * (~p + 1) * (~e * ~f + ~d * ~g))) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ (~p + 1), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~n], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (LtQ(~p, -1) && RationalQ(~n))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (-(~e) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * ((~m - ~n) - 1)) - ((~n * ((~c * ~e * ~f + ~c * ~d * ~g) - ~b * ~e * ~g)) / (~c * ~e * ((~m - ~n) - 1))) * Antiderivative((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ (~n - 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (GtQ(~n, 0) && (NeQ((~m - ~n) - 1, 0) && (IntegerQ(2 * ~p) || IntegerQ(~n)))))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (-(~e) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * ((~m - ~n) - 1)) - ((~n * (~e * ~f + ~d * ~g)) / (~e * ((~m - ~n) - 1))) * Antiderivative((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ (~n - 1) * (~a + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (GtQ(~n, 0) && (NeQ((~m - ~n) - 1, 0) && (IntegerQ(2 * ~p) || IntegerQ(~n))))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (-((~e) ^ 2) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / ((~n + 1) * ((~c * ~e * ~f + ~c * ~d * ~g) - ~b * ~e * ~g)) - ((~c * ~e * ((~m - ~n) - 2)) / ((~n + 1) * ((~c * ~e * ~f + ~c * ~d * ~g) - ~b * ~e * ~g))) * Antiderivative((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (LtQ(~n, -1) && IntegerQ(2 * ~p)))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (-((~e) ^ 2) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / ((~n + 1) * (~c * ~e * ~f + ~c * ~d * ~g)) - ((~e * ((~m - ~n) - 2)) / ((~n + 1) * (~e * ~f + ~d * ~g))) * Antiderivative((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~p, 0) && (LtQ(~n, -1) && IntegerQ(2 * ~p))))))
    @apply_utils Antiderivative(sqrt(~d + ~(e') * ~x) / ((~(f') + ~(g') * ~x) * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)), ~x) => 2 * (~e) ^ 2 * Subst(Antiderivative(1 / ((~c * (~e * ~f + ~d * ~g) - ~b * ~e * ~g) + (~e) ^ 2 * ~g * (~x) ^ 2), ~x), ~x, sqrt(~a + ~b * ~x + ~c * (~x) ^ 2) / sqrt(~d + ~e * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0)))
    @apply_utils Antiderivative(sqrt(~d + ~(e') * ~x) / ((~(f') + ~(g') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2)), ~x) => 2 * (~e) ^ 2 * Subst(Antiderivative(1 / (~c * (~e * ~f + ~d * ~g) + (~e) ^ 2 * ~g * (~x) ^ 2), ~x), ~x, sqrt(~a + ~c * (~x) ^ 2) / sqrt(~d + ~e * ~x)) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~e) ^ 2 * (~d + ~e * ~x) ^ (~m - 2) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * ~g * (~n + ~p + 2)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ((~m + ~p) - 1, 0) && (EqQ((~b * ~e * ~g * (~n + 1) + ~c * ~e * ~f * (~p + 1)) - ~c * ~d * ~g * (2 * ~n + ~p + 3), 0) && NeQ(~n + ~p + 2, 0)))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~e) ^ 2 * (~d + ~e * ~x) ^ (~m - 2) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * ~g * (~n + ~p + 2)) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ((~m + ~p) - 1, 0) && (EqQ(~e * ~f * (~p + 1) - ~d * ~g * (2 * ~n + ~p + 3), 0) && NeQ(~n + ~p + 2, 0))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~e) ^ 2 * (~e * ~f - ~d * ~g) * (~d + ~e * ~x) ^ (~m - 2) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / (~g * (~n + 1) * ((~c * ~e * ~f + ~c * ~d * ~g) - ~b * ~e * ~g)) - ((~e * ((~b * ~e * ~g * (~n + 1) + ~c * ~e * ~f * (~p + 1)) - ~c * ~d * ~g * (2 * ~n + ~p + 3))) / (~g * (~n + 1) * ((~c * ~e * ~f + ~c * ~d * ~g) - ~b * ~e * ~g))) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ((~m + ~p) - 1, 0) && (LtQ(~n, -1) && IntegerQ(2 * ~p)))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~e) ^ 2 * (~e * ~f - ~d * ~g) * (~d + ~e * ~x) ^ (~m - 2) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * ~g * (~n + 1) * (~e * ~f + ~d * ~g)) - ((~e * (~e * ~f * (~p + 1) - ~d * ~g * (2 * ~n + ~p + 3))) / (~g * (~n + 1) * (~e * ~f + ~d * ~g))) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ((~m + ~p) - 1, 0) && (LtQ(~n, -1) && IntegerQ(2 * ~p))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~e) ^ 2 * (~d + ~e * ~x) ^ (~m - 2) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * ~g * (~n + ~p + 2)) - (((~b * ~e * ~g * (~n + 1) + ~c * ~e * ~f * (~p + 1)) - ~c * ~d * ~g * (2 * ~n + ~p + 3)) / (~c * ~g * (~n + ~p + 2))) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ((~m + ~p) - 1, 0) && (Not(LtQ(~n, -1)) && IntegerQ(2 * ~p)))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~e) ^ 2 * (~d + ~e * ~x) ^ (~m - 2) * (~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * ~g * (~n + ~p + 2)) - ((~e * ~f * (~p + 1) - ~d * ~g * (2 * ~n + ~p + 3)) / (~g * (~n + ~p + 2))) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ((~m + ~p) - 1, 0) && (Not(LtQ(~n, -1)) && IntegerQ(2 * ~p))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => Antiderivative(ExpandIntegrand((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (ILtQ(~m, 0) && ((ILtQ(~n, 0) || IGtQ(~n, 0) && ILtQ(~p + 1 / 2, 0)) && Not(IGtQ(~n, 0))))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => Antiderivative(ExpandIntegrand(1 / sqrt(~a + ~c * (~x) ^ 2), (~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ (~p + 1 / 2), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IntegerQ(~p - 1 / 2) && (ILtQ(~m, 0) && (ILtQ(~n, 0) && Not(IGtQ(~n, 0)))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => Antiderivative(ExpandIntegrand((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (ILtQ(~m, 0) && ((ILtQ(~n, 0) || IGtQ(~n, 0) && ILtQ(~p + 1 / 2, 0)) && Not(IGtQ(~n, 0)))))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~(m') * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => With([Q = PolynomialQuotient((~f + ~g * ~x) ^ ~n, ~a * ~e + ~c * ~d * ~x, ~x), h = PolynomialRemainder((~f + ~g * ~x) ^ ~n, ~a * ~e + ~c * ~d * ~x, ~x)], (h * (2 * ~c * ~d - ~b * ~e) * (~d + ~e * ~x) ^ ~m * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / (~e * (~p + 1) * ((~b) ^ 2 - 4 * ~a * ~c)) + (1 / ((~p + 1) * ((~b) ^ 2 - 4 * ~a * ~c))) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1) * ExpandToSum(~d * ~e * (~p + 1) * ((~b) ^ 2 - 4 * ~a * ~c) * Q - h * (2 * ~c * ~d - ~b * ~e) * (~m + 2 * ~p + 2), ~x), ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (ILtQ(~p + 1 / 2, 0) && (IGtQ(~m, 0) && (IGtQ(~n, 0) && Not(IGtQ(~n, 0))))))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~(m') * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => With([Q = PolynomialQuotient((~f + ~g * ~x) ^ ~n, ~a * ~e + ~c * ~d * ~x, ~x), h = PolynomialRemainder((~f + ~g * ~x) ^ ~n, ~a * ~e + ~c * ~d * ~x, ~x)], (-(~d) * h * (~d + ~e * ~x) ^ ~m * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (2 * ~a * ~e * (~p + 1)) + (~d / (2 * ~a * (~p + 1))) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~a + ~c * (~x) ^ 2) ^ (~p + 1) * ExpandToSum(2 * ~a * ~e * (~p + 1) * Q + h * (~m + 2 * ~p + 2), ~x), ~x)) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (ILtQ(~p + 1 / 2, 0) && (IGtQ(~m, 0) && (IGtQ(~n, 0) && Not(IGtQ(~n, 0)))))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => Antiderivative(ExpandIntegrand((~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, (~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~n + 2 * ~p + 1, 0) && (ILtQ(~m, 0) && ILtQ(~n, 0)))))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => Antiderivative(ExpandIntegrand((~a + ~c * (~x) ^ 2) ^ ~p, (~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (EqQ(~m + ~n + 2 * ~p + 1, 0) && (ILtQ(~m, 0) && ILtQ(~n, 0))))))
    #= Antiderivative(((~d')+(~e')*(~x))^(~m')*((~f')+(~g')*(~x))^(~n)*((~a')+(~b')*(~x)+(~c')*(~x)^2)^(~p),(~x)*Symbol) :=  g^n*(d+e*x)^(m+n-1)*(a+b*x+c*x^2)^(p+1)/(c*e^(n-1)*(m+n+2*p+1)) + 1/(c*e^n*(m+n+2*p+1))*Antiderivative((d+e*x)^m*(a+b*x+c*x^2)^p* ExpandToSum(c*e^n*(m+n+2*p+1)*(f+g*x)^n-c*g^n*(m+n+2*p+1)*(d+e*x)^ n+e*g^n*(m+p+n)*(d+e*x)^(n-2)*(b*d-2*a*e+(2*c*d-b*e)*x),x),x) <--  FreeQ([a,b,c,d,e,f,g,m,p],x) && NeQ(e*f-d*g,0) && NeQ(b^2-4*a*c,0) &&  EqQ(c*d^2-b*d*e+a*e^2,0) && Not(IntegerQ(p)) && NeQ(m+n+2*p+1,0) && IGtQ(n,0) =#
    #= Antiderivative(((~d')+(~e')*(~x))^(~m')*((~f')+(~g')*(~x))^(~n)*((~a)+(~c')*(~x)^2)^(~p),~x) :=   g^n*(d+e*x)^(m+n-1)*(a+c*x^2)^(p+1)/(c*e^(n-1)*(m+n+2*p+1)) + 1/(c*e^n*(m+n+2*p+1))*Antiderivative((d+e*x)^m*(a+c*x^2)^p* ExpandToSum(c*e^n*(m+n+2*p+1)*(f+g*x)^n-c*g^n*(m+n+2*p+1)*(d+e*x)^ n-2*e*g^n*(m+p+n)*(d+e*x)^(n-2)*(a*e-c*d*x),x),x) <--  FreeQ([a,c,d,e,f,g,m,p],x) && NeQ(e*f-d*g,0) && EqQ(c*d^2+a*e^2,0) &&  Not(IntegerQ(p)) && NeQ(m+n+2*p+1,0) && IGtQ(n,0) =#
    @apply_utils Antiderivative((~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (((~e * ~x) ^ ~m * (~b * ~x + ~c * (~x) ^ 2) ^ ~p) / ((~x) ^ (~m + ~p) * (~b + ~c * ~x) ^ ~p)) * Antiderivative((~x) ^ (~m + ~p) * (~f + ~g * ~x) ^ ~n * (~b + ~c * ~x) ^ ~p, ~x) <-- FreeQ([~b, ~c, ~e, ~f, ~g, ~m, ~n], ~x) && (Not(IntegerQ(~p)) && Not(IGtQ(~n, 0)))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => Antiderivative((~d + ~e * ~x) ^ (~m + ~p) * (~f + ~g * ~x) ^ ~n * (~a / ~d + (~c / ~e) * ~x) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~n], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (GtQ(~a, 0) && (GtQ(~d, 0) && (Not(IGtQ(~m, 0)) && Not(IGtQ(~n, 0))))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~a + ~b * ~x + ~c * (~x) ^ 2) ^ FracPart(~p) / ((~d + ~e * ~x) ^ FracPart(~p) * (~a / ~d + (~c * ~x) / ~e) ^ FracPart(~p))) * Antiderivative((~d + ~e * ~x) ^ (~m + ~p) * (~f + ~g * ~x) ^ ~n * (~a / ~d + (~c / ~e) * ~x) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (EqQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (Not(IGtQ(~m, 0)) && Not(IGtQ(~n, 0)))))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~a + ~c * (~x) ^ 2) ^ FracPart(~p) / ((~d + ~e * ~x) ^ FracPart(~p) * (~a / ~d + (~c * ~x) / ~e) ^ FracPart(~p))) * Antiderivative((~d + ~e * ~x) ^ (~m + ~p) * (~f + ~g * ~x) ^ ~n * (~a / ~d + (~c / ~e) * ~x) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~n], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (EqQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && (Not(IGtQ(~m, 0)) && Not(IGtQ(~n, 0))))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => Antiderivative(ExpandIntegrand((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IntegerQ(~p) && (EqQ(~p, 1) && IntegersQ(~m, ~n) || ILtQ(~m, 0) && ILtQ(~n, 0))))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => Antiderivative(ExpandIntegrand((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IntegerQ(~p) && (EqQ(~p, 1) && IntegersQ(~m, ~n) || ILtQ(~m, 0) && ILtQ(~n, 0)))))
    @apply_utils Antiderivative((~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p / ((~(d') + ~(e') * ~x) * (~(f') + ~(g') * ~x)), ~x) => (((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2) / (~e * (~e * ~f - ~d * ~g))) * Antiderivative((~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p - 1) / (~d + ~e * ~x), ~x) - (1 / (~e * (~e * ~f - ~d * ~g))) * Antiderivative((Simp(((~c * ~d * ~f - ~b * ~e * ~f) + ~a * ~e * ~g) - ~c * (~e * ~f - ~d * ~g) * ~x, ~x) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p - 1)) / (~f + ~g * ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (FractionQ(~p) && GtQ(~p, 0)))))
    @apply_utils Antiderivative((~a + ~(c') * (~x) ^ 2) ^ ~p / ((~(d') + ~(e') * ~x) * (~(f') + ~(g') * ~x)), ~x) => ((~c * (~d) ^ 2 + ~a * (~e) ^ 2) / (~e * (~e * ~f - ~d * ~g))) * Antiderivative((~a + ~c * (~x) ^ 2) ^ (~p - 1) / (~d + ~e * ~x), ~x) - (1 / (~e * (~e * ~f - ~d * ~g))) * Antiderivative((Simp((~c * ~d * ~f + ~a * ~e * ~g) - ~c * (~e * ~f - ~d * ~g) * ~x, ~x) * (~a + ~c * (~x) ^ 2) ^ (~p - 1)) / (~f + ~g * ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (FractionQ(~p) && GtQ(~p, 0))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => With([q = Denominator(~m)], (q / ~e) * Subst(Antiderivative((~x) ^ (q * (~m + 1) - 1) * ((~e * ~f - ~d * ~g) / ~e + (~g * (~x) ^ q) / ~e) ^ ~n * ((((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2) / (~e) ^ 2 - ((2 * ~c * ~d - ~b * ~e) * (~x) ^ q) / (~e) ^ 2) + (~c * (~x) ^ (2q)) / (~e) ^ 2) ^ ~p, ~x), ~x, (~d + ~e * ~x) ^ (1 / q))) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IntegersQ(~n, ~p) && FractionQ(~m)))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => With([q = Denominator(~m)], (q / ~e) * Subst(Antiderivative((~x) ^ (q * (~m + 1) - 1) * ((~e * ~f - ~d * ~g) / ~e + (~g * (~x) ^ q) / ~e) ^ ~n * (((~c * (~d) ^ 2 + ~a * (~e) ^ 2) / (~e) ^ 2 - (2 * ~c * ~d * (~x) ^ q) / (~e) ^ 2) + (~c * (~x) ^ (2q)) / (~e) ^ 2) ^ ~p, ~x), ~x, (~d + ~e * ~x) ^ (1 / q))) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IntegersQ(~n, ~p) && FractionQ(~m))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~f + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => Antiderivative((~d * ~f + ~e * ~g * (~x) ^ 2) ^ ~m * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (EqQ(~m - ~n, 0) && (EqQ(~e * ~f + ~d * ~g, 0) && (IntegerQ(~m) || GtQ(~d, 0) && GtQ(~f, 0))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~f + ~(g') * ~x) ^ ~n * (~(a') + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => Antiderivative((~d * ~f + ~e * ~g * (~x) ^ 2) ^ ~m * (~a + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (EqQ(~m - ~n, 0) && (EqQ(~e * ~f + ~d * ~g, 0) && (IntegerQ(~m) || GtQ(~d, 0) && GtQ(~f, 0))))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~f + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => (((~d + ~e * ~x) ^ FracPart(~m) * (~f + ~g * ~x) ^ FracPart(~m)) / (~d * ~f + ~e * ~g * (~x) ^ 2) ^ FracPart(~m)) * Antiderivative((~d * ~f + ~e * ~g * (~x) ^ 2) ^ ~m * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (EqQ(~m - ~n, 0) && EqQ(~e * ~f + ~d * ~g, 0))
    @apply_utils Antiderivative((~d + ~(e') * ~x) ^ ~m * (~f + ~(g') * ~x) ^ ~n * (~(a') + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (((~d + ~e * ~x) ^ FracPart(~m) * (~f + ~g * ~x) ^ FracPart(~m)) / (~d * ~f + ~e * ~g * (~x) ^ 2) ^ FracPart(~m)) * Antiderivative((~d * ~f + ~e * ~g * (~x) ^ 2) ^ ~m * (~a + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (EqQ(~m - ~n, 0) && EqQ(~e * ~f + ~d * ~g, 0))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n) / (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2), ~x) => (~g / (~c) ^ 2) * Antiderivative(Simp(((2 * ~c * ~e * ~f + ~c * ~d * ~g) - ~b * ~e * ~g) + ~c * ~e * ~g * ~x, ~x) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n - 2), ~x) + (1 / (~c) ^ 2) * Antiderivative((Simp((((~c) ^ 2 * ~d * (~f) ^ 2 - 2 * ~a * ~c * ~e * ~f * ~g) - ~a * ~c * ~d * (~g) ^ 2) + ~a * ~b * ~e * (~g) ^ 2 + ((((((~c) ^ 2 * ~e * (~f) ^ 2 + 2 * (~c) ^ 2 * ~d * ~f * ~g) - 2 * ~b * ~c * ~e * ~f * ~g) - ~b * ~c * ~d * (~g) ^ 2) + (~b) ^ 2 * ~e * (~g) ^ 2) - ~a * ~c * ~e * (~g) ^ 2) * ~x, ~x) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n - 2)) / (~a + ~b * ~x + ~c * (~x) ^ 2), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~m)) && (Not(IntegerQ(~n)) && (GtQ(~m, 0) && GtQ(~n, 1))))))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n) / (~a + ~(c') * (~x) ^ 2), ~x) => (~g / ~c) * Antiderivative(Simp(2 * ~e * ~f + ~d * ~g + ~e * ~g * ~x, ~x) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n - 2), ~x) + (1 / ~c) * Antiderivative((Simp(((~c * ~d * (~f) ^ 2 - 2 * ~a * ~e * ~f * ~g) - ~a * ~d * (~g) ^ 2) + ((~c * ~e * (~f) ^ 2 + 2 * ~c * ~d * ~f * ~g) - ~a * ~e * (~g) ^ 2) * ~x, ~x) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n - 2)) / (~a + ~c * (~x) ^ 2), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~m)) && (Not(IntegerQ(~n)) && (GtQ(~m, 0) && GtQ(~n, 1)))))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n) / (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2), ~x) => ((~e * ~g) / ~c) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n - 1), ~x) + (1 / ~c) * Antiderivative((Simp((~c * ~d * ~f - ~a * ~e * ~g) + ((~c * ~e * ~f + ~c * ~d * ~g) - ~b * ~e * ~g) * ~x, ~x) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n - 1)) / (~a + ~b * ~x + ~c * (~x) ^ 2), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~m)) && (Not(IntegerQ(~n)) && (GtQ(~m, 0) && GtQ(~n, 0))))))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n) / (~a + ~(c') * (~x) ^ 2), ~x) => ((~e * ~g) / ~c) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n - 1), ~x) + (1 / ~c) * Antiderivative((Simp((~c * ~d * ~f - ~a * ~e * ~g) + (~c * ~e * ~f + ~c * ~d * ~g) * ~x, ~x) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n - 1)) / (~a + ~c * (~x) ^ 2), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~m)) && (Not(IntegerQ(~n)) && (GtQ(~m, 0) && GtQ(~n, 0)))))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n) / (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2), ~x) => ((-(~g) * (~e * ~f - ~d * ~g)) / ((~c * (~f) ^ 2 - ~b * ~f * ~g) + ~a * (~g) ^ 2)) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ ~n, ~x) + (1 / ((~c * (~f) ^ 2 - ~b * ~f * ~g) + ~a * (~g) ^ 2)) * Antiderivative((Simp((~c * ~d * ~f - ~b * ~d * ~g) + ~a * ~e * ~g + ~c * (~e * ~f - ~d * ~g) * ~x, ~x) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n + 1)) / (~a + ~b * ~x + ~c * (~x) ^ 2), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~m)) && (Not(IntegerQ(~n)) && (GtQ(~m, 0) && LtQ(~n, -1))))))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n) / (~a + ~(c') * (~x) ^ 2), ~x) => ((-(~g) * (~e * ~f - ~d * ~g)) / (~c * (~f) ^ 2 + ~a * (~g) ^ 2)) * Antiderivative((~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ ~n, ~x) + (1 / (~c * (~f) ^ 2 + ~a * (~g) ^ 2)) * Antiderivative((Simp(~c * ~d * ~f + ~a * ~e * ~g + ~c * (~e * ~f - ~d * ~g) * ~x, ~x) * (~d + ~e * ~x) ^ (~m - 1) * (~f + ~g * ~x) ^ (~n + 1)) / (~a + ~c * (~x) ^ 2), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~m)) && (Not(IntegerQ(~n)) && (GtQ(~m, 0) && LtQ(~n, -1)))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m / (sqrt(~(f') + ~(g') * ~x) * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)), ~x) => Antiderivative(ExpandIntegrand(1 / (sqrt(~d + ~e * ~x) * sqrt(~f + ~g * ~x)), (~d + ~e * ~x) ^ (~m + 1 / 2) / (~a + ~b * ~x + ~c * (~x) ^ 2), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && IGtQ(~m + 1 / 2, 0)))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m / (sqrt(~(f') + ~(g') * ~x) * (~(a') + ~(c') * (~x) ^ 2)), ~x) => Antiderivative(ExpandIntegrand(1 / (sqrt(~d + ~e * ~x) * sqrt(~f + ~g * ~x)), (~d + ~e * ~x) ^ (~m + 1 / 2) / (~a + ~c * (~x) ^ 2), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && IGtQ(~m + 1 / 2, 0))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n) / (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2), ~x) => Antiderivative(ExpandIntegrand((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n, 1 / (~a + ~b * ~x + ~c * (~x) ^ 2), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n], ~x) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~m)) && Not(IntegerQ(~n)))))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n) / (~a + ~(c') * (~x) ^ 2), ~x) => Antiderivative(ExpandIntegrand((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n, 1 / (~a + ~c * (~x) ^ 2), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~n], ~x) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~m)) && Not(IntegerQ(~n))))
    @apply_utils Antiderivative((~x) ^ 2 * (~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => ((~d + ~e * ~x) ^ (~m + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * ~e * (~m + 2 * ~p + 3)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~p], ~x) && (EqQ(~b * ~e * (~m + ~p + 2) + 2 * ~c * ~d * (~p + 1), 0) && (EqQ(~b * ~d * (~p + 1) + ~a * ~e * (~m + 1), 0) && NeQ(~m + 2 * ~p + 3, 0)))
    @apply_utils Antiderivative((~x) ^ 2 * (~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => ((~d + ~e * ~x) ^ (~m + 1) * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (~c * ~e * (~m + 2 * ~p + 3)) <-- FreeQ([~a, ~c, ~d, ~e, ~m, ~p], ~x) && (EqQ(~d * (~p + 1), 0) && (EqQ(~a * (~m + 1), 0) && NeQ(~m + 2 * ~p + 3, 0)))
    @apply_utils Antiderivative((~(g') * ~x) ^ ~n * (~(d') + ~(e') * ~x) ^ ~m * (~a + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => (((~d + ~e * ~x) ^ FracPart(~p) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ FracPart(~p)) / (~a * ~d + ~c * ~e * (~x) ^ 3) ^ FracPart(~p)) * Antiderivative((~g * ~x) ^ ~n * (~a * ~d + ~c * ~e * (~x) ^ 3) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~g, ~m, ~n, ~p], ~x) && (EqQ(~m - ~p, 0) && (EqQ(~b * ~d + ~a * ~e, 0) && EqQ(~c * ~d + ~b * ~e, 0)))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~(m') * sqrt(~(f') + ~(g') * ~x) * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2), ~x) => ((~d + ~e * ~x) ^ (~m + 1) * sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)) / (~e * (~m + 1)) - (1 / (2 * ~e * (~m + 1))) * Antiderivative(((~d + ~e * ~x) ^ (~m + 1) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2))) * Simp(~b * ~f + ~a * ~g + 2 * (~c * ~f + ~b * ~g) * ~x + 3 * ~c * ~g * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && LtQ(~m, -1)))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~(m') * sqrt(~(f') + ~(g') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2), ~x) => ((~d + ~e * ~x) ^ (~m + 1) * sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)) / (~e * (~m + 1)) - (1 / (2 * ~e * (~m + 1))) * Antiderivative(((~d + ~e * ~x) ^ (~m + 1) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2))) * Simp(~a * ~g + 2 * ~c * ~f * ~x + 3 * ~c * ~g * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && LtQ(~m, -1))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~(m') * sqrt(~(f') + ~(g') * ~x) * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2), ~x) => (2 * (~d + ~e * ~x) ^ (~m + 1) * sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)) / (~e * (2 * ~m + 5)) - (1 / (~e * (2 * ~m + 5))) * Antiderivative(((~d + ~e * ~x) ^ ~m / (sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2))) * Simp(((~b * ~d * ~f - 3 * ~a * ~e * ~f) + ~a * ~d * ~g + 2 * (((~c * ~d * ~f - ~b * ~e * ~f) + ~b * ~d * ~g) - ~a * ~e * ~g) * ~x) - ((~c * ~e * ~f - 3 * ~c * ~d * ~g) + ~b * ~e * ~g) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && Not(LtQ(~m, -1))))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~(m') * sqrt(~(f') + ~(g') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2), ~x) => (2 * (~d + ~e * ~x) ^ (~m + 1) * sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)) / (~e * (2 * ~m + 5)) + (1 / (~e * (2 * ~m + 5))) * Antiderivative(((~d + ~e * ~x) ^ ~m / (sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2))) * Simp(((3 * ~a * ~e * ~f - ~a * ~d * ~g) - 2 * (~c * ~d * ~f - ~a * ~e * ~g) * ~x) + (~c * ~e * ~f - 3 * ~c * ~d * ~g) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && Not(LtQ(~m, -1)))))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~(m') * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)) / sqrt(~(f') + ~(g') * ~x), ~x) => (2 * (~d + ~e * ~x) ^ ~m * sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)) / (~g * (2 * ~m + 3)) - (1 / (~g * (2 * ~m + 3))) * Antiderivative(((~d + ~e * ~x) ^ (~m - 1) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2))) * Simp((~b * ~d * ~f + 2 * ~a * (~e * ~f * ~m - ~d * ~g * (~m + 1)) + ((2 * ~c * ~d * ~f - 2 * ~a * ~e * ~g) + ~b * (~e * ~f - ~d * ~g) * (2 * ~m + 1)) * ~x) - (~b * ~e * ~g + 2 * ~c * (~d * ~g * ~m - ~e * ~f * (~m + 1))) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && GtQ(~m, 0)))))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~(m') * sqrt(~a + ~(c') * (~x) ^ 2)) / sqrt(~(f') + ~(g') * ~x), ~x) => (2 * (~d + ~e * ~x) ^ ~m * sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)) / (~g * (2 * ~m + 3)) - (1 / (~g * (2 * ~m + 3))) * Antiderivative(((~d + ~e * ~x) ^ (~m - 1) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2))) * Simp((2 * ~a * (~e * ~f * ~m - ~d * ~g * (~m + 1)) + (2 * ~c * ~d * ~f - 2 * ~a * ~e * ~g) * ~x) - (2 * ~c * (~d * ~g * ~m - ~e * ~f * (~m + 1))) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && GtQ(~m, 0))))
    @apply_utils Antiderivative(sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) / ((~(d') + ~(e') * ~x) * sqrt(~(f') + ~(g') * ~x)), ~x) => (((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2) / (~e) ^ 2) * Antiderivative(1 / ((~d + ~e * ~x) * sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)), ~x) - (1 / (~e) ^ 2) * Antiderivative(((~c * ~d - ~b * ~e) - ~c * ~e * ~x) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0)))
    @apply_utils Antiderivative(sqrt(~a + ~(c') * (~x) ^ 2) / ((~(d') + ~(e') * ~x) * sqrt(~(f') + ~(g') * ~x)), ~x) => ((~c * (~d) ^ 2 + ~a * (~e) ^ 2) / (~e) ^ 2) * Antiderivative(1 / ((~d + ~e * ~x) * sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)), ~x) - (1 / (~e) ^ 2) * Antiderivative((~c * ~d - ~c * ~e * ~x) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~(m') * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)) / sqrt(~(f') + ~(g') * ~x), ~x) => ((~d + ~e * ~x) ^ (~m + 1) * sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)) / ((~m + 1) * (~e * ~f - ~d * ~g)) - (1 / (2 * (~m + 1) * (~e * ~f - ~d * ~g))) * Antiderivative(((~d + ~e * ~x) ^ (~m + 1) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2))) * Simp(~b * ~f + ~a * ~g * (2 * ~m + 3) + 2 * (~c * ~f + ~b * ~g * (~m + 2)) * ~x + ~c * ~g * (2 * ~m + 5) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && LtQ(~m, -1)))))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~(m') * sqrt(~a + ~(c') * (~x) ^ 2)) / sqrt(~(f') + ~(g') * ~x), ~x) => ((~d + ~e * ~x) ^ (~m + 1) * sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)) / ((~m + 1) * (~e * ~f - ~d * ~g)) - (1 / (2 * (~m + 1) * (~e * ~f - ~d * ~g))) * Antiderivative(((~d + ~e * ~x) ^ (~m + 1) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2))) * Simp(~a * ~g * (2 * ~m + 3) + 2 * (~c * ~f) * ~x + ~c * ~g * (2 * ~m + 5) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && LtQ(~m, -1))))
    @apply_utils Antiderivative(sqrt(~(d') + ~(e') * ~x) / (sqrt(~(f') + ~(g') * ~x) * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)), ~x) => With([q = Rt((~b) ^ 2 - 4 * ~a * ~c, 2)], ((sqrt(2) * sqrt(2 * ~c * ~f - ~g * (~b + q)) * sqrt((~b - q) + 2 * ~c * ~x) * (~d + ~e * ~x) * sqrt(((~e * ~f - ~d * ~g) * (~b + q + 2 * ~c * ~x)) / ((2 * ~c * ~f - ~g * (~b + q)) * (~d + ~e * ~x))) * sqrt(((~e * ~f - ~d * ~g) * (2 * ~a + (~b + q) * ~x)) / (((~b * ~f + q * ~f) - 2 * ~a * ~g) * (~d + ~e * ~x)))) / (~g * sqrt(2 * ~c * ~d - ~e * (~b + q)) * sqrt((2 * ~a * ~c) / (~b + q) + ~c * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2))) * Elliptic.Pi((~e * (2 * ~c * ~f - ~g * (~b + q))) / (~g * (2 * ~c * ~d - ~e * (~b + q))), asin((sqrt(2 * ~c * ~d - ~e * (~b + q)) * sqrt(~f + ~g * ~x)) / (sqrt(2 * ~c * ~f - ~g * (~b + q)) * sqrt(~d + ~e * ~x))), (((~b * ~d + q * ~d) - 2 * ~a * ~e) * (2 * ~c * ~f - ~g * (~b + q))) / (((~b * ~f + q * ~f) - 2 * ~a * ~g) * (2 * ~c * ~d - ~e * (~b + q))))) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0)))
    @apply_utils Antiderivative(sqrt(~(d') + ~(e') * ~x) / (sqrt(~(f') + ~(g') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2)), ~x) => With([q = Rt(-4 * ~a * ~c, 2)], ((sqrt(2) * sqrt(2 * ~c * ~f - ~g * q) * sqrt(-q + 2 * ~c * ~x) * (~d + ~e * ~x) * sqrt(((~e * ~f - ~d * ~g) * (q + 2 * ~c * ~x)) / ((2 * ~c * ~f - ~g * q) * (~d + ~e * ~x))) * sqrt(((~e * ~f - ~d * ~g) * (2 * ~a + q * ~x)) / ((q * ~f - 2 * ~a * ~g) * (~d + ~e * ~x)))) / (~g * sqrt(2 * ~c * ~d - ~e * q) * sqrt((2 * ~a * ~c) / q + ~c * ~x) * sqrt(~a + ~c * (~x) ^ 2))) * Elliptic.Pi((~e * (2 * ~c * ~f - ~g * q)) / (~g * (2 * ~c * ~d - ~e * q)), asin((sqrt(2 * ~c * ~d - ~e * q) * sqrt(~f + ~g * ~x)) / (sqrt(2 * ~c * ~f - ~g * q) * sqrt(~d + ~e * ~x))), ((q * ~d - 2 * ~a * ~e) * (2 * ~c * ~f - ~g * q)) / ((q * ~f - 2 * ~a * ~g) * (2 * ~c * ~d - ~e * q)))) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ (3 / 2) / (sqrt(~(f') + ~(g') * ~x) * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)), ~x) => (~e / ~g) * Antiderivative((sqrt(~d + ~e * ~x) * sqrt(~f + ~g * ~x)) / sqrt(~a + ~b * ~x + ~c * (~x) ^ 2), ~x) - ((~e * ~f - ~d * ~g) / ~g) * Antiderivative(sqrt(~d + ~e * ~x) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0)))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ (3 / 2) / (sqrt(~(f') + ~(g') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2)), ~x) => (~e / ~g) * Antiderivative((sqrt(~d + ~e * ~x) * sqrt(~f + ~g * ~x)) / sqrt(~a + ~c * (~x) ^ 2), ~x) - ((~e * ~f - ~d * ~g) / ~g) * Antiderivative(sqrt(~d + ~e * ~x) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m / (sqrt(~(f') + ~(g') * ~x) * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)), ~x) => (2 * (~e) ^ 2 * (~d + ~e * ~x) ^ (~m - 2) * sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)) / (~c * ~g * (2 * ~m - 1)) - (1 / (~c * ~g * (2 * ~m - 1))) * Antiderivative(((~d + ~e * ~x) ^ (~m - 3) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2))) * Simp(((~b * ~d * (~e) ^ 2 * ~f + ~a * (~e) ^ 2 * (~d * ~g + 2 * ~e * ~f * (~m - 2))) - ~c * (~d) ^ 3 * ~g * (2 * ~m - 1)) + ~e * (~e * (2 * ~b * ~d * ~g + ~e * (~b * ~f + ~a * ~g) * (2 * ~m - 3)) + ~c * ~d * (2 * ~e * ~f - 3 * ~d * ~g * (2 * ~m - 1))) * ~x + 2 * (~e) ^ 2 * ((~c * ~e * ~f - 3 * ~c * ~d * ~g) + ~b * ~e * ~g) * (~m - 1) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && GeQ(~m, 2)))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m / (sqrt(~(f') + ~(g') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2)), ~x) => (2 * (~e) ^ 2 * (~d + ~e * ~x) ^ (~m - 2) * sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)) / (~c * ~g * (2 * ~m - 1)) - (1 / (~c * ~g * (2 * ~m - 1))) * Antiderivative(((~d + ~e * ~x) ^ (~m - 3) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2))) * Simp((~a * (~e) ^ 2 * (~d * ~g + 2 * ~e * ~f * (~m - 2)) - ~c * (~d) ^ 3 * ~g * (2 * ~m - 1)) + ~e * (~e * (~a * ~e * ~g * (2 * ~m - 3)) + ~c * ~d * (2 * ~e * ~f - 3 * ~d * ~g * (2 * ~m - 1))) * ~x + 2 * (~e) ^ 2 * (~c * ~e * ~f - 3 * ~c * ~d * ~g) * (~m - 1) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && GeQ(~m, 2))))
    @apply_utils Antiderivative(1 / ((~(d') + ~(e') * ~x) * sqrt(~(f') + ~(g') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2)), ~x) => With([q = Rt(-(~c) / ~a, 2)], (1 / sqrt(~a)) * Antiderivative(1 / ((~d + ~e * ~x) * sqrt(~f + ~g * ~x) * sqrt(1 - q * ~x) * sqrt(1 + q * ~x)), ~x)) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && GtQ(~a, 0)))
    @apply_utils Antiderivative(1 / ((~(d') + ~(e') * ~x) * sqrt(~(f') + ~(g') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2)), ~x) => With([q = Rt(-(~c) / ~a, 2)], (sqrt(1 + (~c * (~x) ^ 2) / ~a) / sqrt(~a + ~c * (~x) ^ 2)) * Antiderivative(1 / ((~d + ~e * ~x) * sqrt(~f + ~g * ~x) * sqrt(1 - q * ~x) * sqrt(1 + q * ~x)), ~x)) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && Not(GtQ(~a, 0))))
    @apply_utils Antiderivative(1 / ((~(d') + ~(e') * ~x) * sqrt(~(f') + ~(g') * ~x) * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)), ~x) => With([q = Rt((~b) ^ 2 - 4 * ~a * ~c, 2)], ((sqrt((~b - q) + 2 * ~c * ~x) * sqrt(~b + q + 2 * ~c * ~x)) / sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)) * Antiderivative(1 / ((~d + ~e * ~x) * sqrt(~f + ~g * ~x) * sqrt((~b - q) + 2 * ~c * ~x) * sqrt(~b + q + 2 * ~c * ~x)), ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0)))
    @apply_utils Antiderivative(1 / (sqrt(~(d') + ~(e') * ~x) * sqrt(~(f') + ~(g') * ~x) * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)), ~x) => ((-2 * (~d + ~e * ~x) * sqrt(((~e * ~f - ~d * ~g) ^ 2 * (~a + ~b * ~x + ~c * (~x) ^ 2)) / (((~c * (~f) ^ 2 - ~b * ~f * ~g) + ~a * (~g) ^ 2) * (~d + ~e * ~x) ^ 2))) / ((~e * ~f - ~d * ~g) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2))) * Subst(Antiderivative(1 / sqrt((1 - ((((2 * ~c * ~d * ~f - ~b * ~e * ~f) - ~b * ~d * ~g) + 2 * ~a * ~e * ~g) * (~x) ^ 2) / ((~c * (~f) ^ 2 - ~b * ~f * ~g) + ~a * (~g) ^ 2)) + (((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2) * (~x) ^ 4) / ((~c * (~f) ^ 2 - ~b * ~f * ~g) + ~a * (~g) ^ 2)), ~x), ~x, sqrt(~f + ~g * ~x) / sqrt(~d + ~e * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0)))
    @apply_utils Antiderivative(1 / (sqrt(~(d') + ~(e') * ~x) * sqrt(~(f') + ~(g') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2)), ~x) => ((-2 * (~d + ~e * ~x) * sqrt(((~e * ~f - ~d * ~g) ^ 2 * (~a + ~c * (~x) ^ 2)) / ((~c * (~f) ^ 2 + ~a * (~g) ^ 2) * (~d + ~e * ~x) ^ 2))) / ((~e * ~f - ~d * ~g) * sqrt(~a + ~c * (~x) ^ 2))) * Subst(Antiderivative(1 / sqrt((1 - ((2 * ~c * ~d * ~f + 2 * ~a * ~e * ~g) * (~x) ^ 2) / (~c * (~f) ^ 2 + ~a * (~g) ^ 2)) + ((~c * (~d) ^ 2 + ~a * (~e) ^ 2) * (~x) ^ 4) / (~c * (~f) ^ 2 + ~a * (~g) ^ 2)), ~x), ~x, sqrt(~f + ~g * ~x) / sqrt(~d + ~e * ~x)) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0))
    @apply_utils Antiderivative(1 / ((~(d') + ~(e') * ~x) ^ (3 / 2) * sqrt(~(f') + ~(g') * ~x) * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)), ~x) => (-(~g) / (~e * ~f - ~d * ~g)) * Antiderivative(1 / (sqrt(~d + ~e * ~x) * sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)), ~x) + (~e / (~e * ~f - ~d * ~g)) * Antiderivative(sqrt(~f + ~g * ~x) / ((~d + ~e * ~x) ^ (3 / 2) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0)))
    @apply_utils Antiderivative(1 / ((~(d') + ~(e') * ~x) ^ (3 / 2) * sqrt(~(f') + ~(g') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2)), ~x) => (-(~g) / (~e * ~f - ~d * ~g)) * Antiderivative(1 / (sqrt(~d + ~e * ~x) * sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)), ~x) + (~e / (~e * ~f - ~d * ~g)) * Antiderivative(sqrt(~f + ~g * ~x) / ((~d + ~e * ~x) ^ (3 / 2) * sqrt(~a + ~c * (~x) ^ 2)), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m / (sqrt(~(f') + ~(g') * ~x) * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)), ~x) => ((~e) ^ 2 * (~d + ~e * ~x) ^ (~m + 1) * sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)) / ((~m + 1) * (~e * ~f - ~d * ~g) * ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) + (1 / (2 * (~m + 1) * (~e * ~f - ~d * ~g) * ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2))) * Antiderivative(((~d + ~e * ~x) ^ (~m + 1) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2))) * Simp(((2 * ~d * ((~c * ~e * ~f - ~c * ~d * ~g) + ~b * ~e * ~g) * (~m + 1) - (~e) ^ 2 * (~b * ~f + ~a * ~g) * (2 * ~m + 3)) + 2 * ~e * (~c * ~d * ~g * (~m + 1) - ~e * (~c * ~f + ~b * ~g) * (~m + 2)) * ~x) - ~c * (~e) ^ 2 * ~g * (2 * ~m + 5) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && LeQ(~m, -2)))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m / (sqrt(~(f') + ~(g') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2)), ~x) => ((~e) ^ 2 * (~d + ~e * ~x) ^ (~m + 1) * sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)) / ((~m + 1) * (~e * ~f - ~d * ~g) * (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) + (1 / (2 * (~m + 1) * (~e * ~f - ~d * ~g) * (~c * (~d) ^ 2 + ~a * (~e) ^ 2))) * Antiderivative(((~d + ~e * ~x) ^ (~m + 1) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2))) * Simp(((2 * ~d * (~c * ~e * ~f - ~c * ~d * ~g) * (~m + 1) - ~a * (~e) ^ 2 * ~g * (2 * ~m + 3)) + 2 * ~e * (~c * ~d * ~g * (~m + 1) - ~c * ~e * ~f * (~m + 2)) * ~x) - ~c * (~e) ^ 2 * ~g * (2 * ~m + 5) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && LeQ(~m, -2))))
    #= Antiderivative(sqrt((~d')+(~e')*(~x))*sqrt((~f')+(~g')*(~x))/sqrt((~a')+(~b')*(~x)+(~c')*(~x)^2),(~x)*Symbol) := 0 <-- FreeQ([a,b,c,d,e,f,g],x) && NeQ(e*f-d*g,0) &&  NeQ(b^2-4*a*c,0) && NeQ(c*d^2-b*d*e+a*e^2,0) =#
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~m * sqrt(~(f') + ~(g') * ~x)) / sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2), ~x) => (2 * ~e * (~d + ~e * ~x) ^ (~m - 1) * sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)) / (~c * (2 * ~m + 1)) - (1 / (~c * (2 * ~m + 1))) * Antiderivative(((~d + ~e * ~x) ^ (~m - 2) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2))) * Simp((~e * (~b * ~d * ~f + ~a * (~d * ~g + 2 * ~e * ~f * (~m - 1))) - ~c * (~d) ^ 2 * ~f * (2 * ~m + 1)) + ((~a * (~e) ^ 2 * ~g * (2 * ~m - 1) - ~c * ~d * (4 * ~e * ~f * ~m + ~d * ~g * (2 * ~m + 1))) + ~b * ~e * (2 * ~d * ~g + ~e * ~f * (2 * ~m - 1))) * ~x + ~e * (2 * ~b * ~e * ~g * ~m - ~c * (~e * ~f + ~d * ~g * (4 * ~m - 1))) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && GtQ(~m, 1)))))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~m * sqrt(~(f') + ~(g') * ~x)) / sqrt(~a + ~(c') * (~x) ^ 2), ~x) => (2 * ~e * (~d + ~e * ~x) ^ (~m - 1) * sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)) / (~c * (2 * ~m + 1)) - (1 / (~c * (2 * ~m + 1))) * Antiderivative(((~d + ~e * ~x) ^ (~m - 2) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2))) * Simp(((~a * ~e * (~d * ~g + 2 * ~e * ~f * (~m - 1)) - ~c * (~d) ^ 2 * ~f * (2 * ~m + 1)) + (~a * (~e) ^ 2 * ~g * (2 * ~m - 1) - ~c * ~d * (4 * ~e * ~f * ~m + ~d * ~g * (2 * ~m + 1))) * ~x) - ~c * ~e * (~e * ~f + ~d * ~g * (4 * ~m - 1)) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && GtQ(~m, 1))))
    @apply_utils Antiderivative(sqrt(~(f') + ~(g') * ~x) / ((~(d') + ~(e') * ~x) * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)), ~x) => (~g / ~e) * Antiderivative(1 / (sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)), ~x) + ((~e * ~f - ~d * ~g) / ~e) * Antiderivative(1 / ((~d + ~e * ~x) * sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0)))
    @apply_utils Antiderivative(sqrt(~(f') + ~(g') * ~x) / ((~(d') + ~(e') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2)), ~x) => (~g / ~e) * Antiderivative(1 / (sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)), ~x) + ((~e * ~f - ~d * ~g) / ~e) * Antiderivative(1 / ((~d + ~e * ~x) * sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~m * sqrt(~(f') + ~(g') * ~x)) / sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2), ~x) => (~e * (~d + ~e * ~x) ^ (~m + 1) * sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)) / ((~m + 1) * ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) + (1 / (2 * (~m + 1) * ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2))) * Antiderivative(((~d + ~e * ~x) ^ (~m + 1) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2))) * Simp(((2 * ~c * ~d * ~f * (~m + 1) - ~e * (~a * ~g + ~b * ~f * (2 * ~m + 3))) - 2 * (~b * ~e * ~g * (2 + ~m) - ~c * (~d * ~g * (~m + 1) - ~e * ~f * (~m + 2))) * ~x) - ~c * ~e * ~g * (2 * ~m + 5) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && LeQ(~m, -2)))))
    @apply_utils Antiderivative(((~(d') + ~(e') * ~x) ^ ~m * sqrt(~(f') + ~(g') * ~x)) / sqrt(~a + ~(c') * (~x) ^ 2), ~x) => (~e * (~d + ~e * ~x) ^ (~m + 1) * sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)) / ((~m + 1) * (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) + (1 / (2 * (~m + 1) * (~c * (~d) ^ 2 + ~a * (~e) ^ 2))) * Antiderivative(((~d + ~e * ~x) ^ (~m + 1) / (sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2))) * Simp(((2 * ~c * ~d * ~f * (~m + 1) - ~e * (~a * ~g)) + 2 * ~c * (~d * ~g * (~m + 1) - ~e * ~f * (~m + 2)) * ~x) - ~c * ~e * ~g * (2 * ~m + 5) * (~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IntegerQ(2 * ~m) && LeQ(~m, -2))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => Antiderivative(ExpandIntegrand((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IGtQ(~p, 0) && (IGtQ(~m, 0) || EqQ(~m, -2) && (EqQ(~p, 1) && EqQ(2 * ~c * ~d - ~b * ~e, 0)))))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => Antiderivative(ExpandIntegrand((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IGtQ(~p, 0) && (IGtQ(~m, 0) || EqQ(~m, -2) && (EqQ(~p, 1) && EqQ(~d, 0))))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => With([Qx = PolynomialQuotient((~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~d + ~e * ~x, ~x), R = PolynomialRemainder((~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~d + ~e * ~x, ~x)], (R * (~d + ~e * ~x) ^ (~m + 1) * (~f + ~g * ~x) ^ (~n + 1)) / ((~m + 1) * (~e * ~f - ~d * ~g)) + (1 / ((~m + 1) * (~e * ~f - ~d * ~g))) * Antiderivative((~d + ~e * ~x) ^ (~m + 1) * (~f + ~g * ~x) ^ ~n * ExpandToSum((~m + 1) * (~e * ~f - ~d * ~g) * Qx - ~g * R * (~m + ~n + 2), ~x), ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IGtQ(~p, 0) && LtQ(~m, -1)))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => With([Qx = PolynomialQuotient((~a + ~c * (~x) ^ 2) ^ ~p, ~d + ~e * ~x, ~x), R = PolynomialRemainder((~a + ~c * (~x) ^ 2) ^ ~p, ~d + ~e * ~x, ~x)], (R * (~d + ~e * ~x) ^ (~m + 1) * (~f + ~g * ~x) ^ (~n + 1)) / ((~m + 1) * (~e * ~f - ~d * ~g)) + (1 / ((~m + 1) * (~e * ~f - ~d * ~g))) * Antiderivative((~d + ~e * ~x) ^ (~m + 1) * (~f + ~g * ~x) ^ ~n * ExpandToSum((~m + 1) * (~e * ~f - ~d * ~g) * Qx - ~g * R * (~m + ~n + 2), ~x), ~x)) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IGtQ(~p, 0) && LtQ(~m, -1))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => ((~c) ^ ~p * (~d + ~e * ~x) ^ (~m + 2 * ~p) * (~f + ~g * ~x) ^ (~n + 1)) / (~g * (~e) ^ (2 * ~p) * (~m + ~n + 2 * ~p + 1)) + (1 / (~g * (~e) ^ (2 * ~p) * (~m + ~n + 2 * ~p + 1))) * Antiderivative((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * ExpandToSum(~g * (~m + ~n + 2 * ~p + 1) * ((~e) ^ (2 * ~p) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p - (~c) ^ ~p * (~d + ~e * ~x) ^ (2 * ~p)) - (~c) ^ ~p * (~e * ~f - ~d * ~g) * (~m + 2 * ~p) * (~d + ~e * ~x) ^ (2 * ~p - 1), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (IGtQ(~p, 0) && (NeQ(~m + ~n + 2 * ~p + 1, 0) && (IntegerQ(~n) || Not(IntegerQ(~m))))))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => ((~c) ^ ~p * (~d + ~e * ~x) ^ (~m + 2 * ~p) * (~f + ~g * ~x) ^ (~n + 1)) / (~g * (~e) ^ (2 * ~p) * (~m + ~n + 2 * ~p + 1)) + (1 / (~g * (~e) ^ (2 * ~p) * (~m + ~n + 2 * ~p + 1))) * Antiderivative((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * ExpandToSum(~g * (~m + ~n + 2 * ~p + 1) * ((~e) ^ (2 * ~p) * (~a + ~c * (~x) ^ 2) ^ ~p - (~c) ^ ~p * (~d + ~e * ~x) ^ (2 * ~p)) - (~c) ^ ~p * (~e * ~f - ~d * ~g) * (~m + 2 * ~p) * (~d + ~e * ~x) ^ (2 * ~p - 1), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (IGtQ(~p, 0) && (NeQ(~m + ~n + 2 * ~p + 1, 0) && (IntegerQ(~n) || Not(IntegerQ(~m)))))))
    @apply_utils Antiderivative(((~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p) / (~(d') + ~(e') * ~x), ~x) => (((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2) / (~e * (~e * ~f - ~d * ~g))) * Antiderivative(((~f + ~g * ~x) ^ (~n + 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p - 1)) / (~d + ~e * ~x), ~x) - (1 / (~e * (~e * ~f - ~d * ~g))) * Antiderivative((~f + ~g * ~x) ^ ~n * (((~c * ~d * ~f - ~b * ~e * ~f) + ~a * ~e * ~g) - ~c * (~e * ~f - ~d * ~g) * ~x) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p - 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~n)) && (Not(IntegerQ(~p)) && (GtQ(~p, 0) && LtQ(~n, -1)))))))
    @apply_utils Antiderivative(((~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p) / (~(d') + ~(e') * ~x), ~x) => ((~c * (~d) ^ 2 + ~a * (~e) ^ 2) / (~e * (~e * ~f - ~d * ~g))) * Antiderivative(((~f + ~g * ~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ (~p - 1)) / (~d + ~e * ~x), ~x) - (1 / (~e * (~e * ~f - ~d * ~g))) * Antiderivative((~f + ~g * ~x) ^ ~n * ((~c * ~d * ~f + ~a * ~e * ~g) - ~c * (~e * ~f - ~d * ~g) * ~x) * (~a + ~c * (~x) ^ 2) ^ (~p - 1), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~n)) && (Not(IntegerQ(~p)) && (GtQ(~p, 0) && LtQ(~n, -1))))))
    @apply_utils Antiderivative(((~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p) / (~(d') + ~(e') * ~x), ~x) => ((~e * (~e * ~f - ~d * ~g)) / ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) * Antiderivative(((~f + ~g * ~x) ^ (~n - 1) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ (~p + 1)) / (~d + ~e * ~x), ~x) + (1 / ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2)) * Antiderivative((~f + ~g * ~x) ^ (~n - 1) * (((~c * ~d * ~f - ~b * ~e * ~f) + ~a * ~e * ~g) - ~c * (~e * ~f - ~d * ~g) * ~x) * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~n)) && (Not(IntegerQ(~p)) && (LtQ(~p, -1) && GtQ(~n, 0)))))))
    @apply_utils Antiderivative(((~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p) / (~(d') + ~(e') * ~x), ~x) => ((~e * (~e * ~f - ~d * ~g)) / (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) * Antiderivative(((~f + ~g * ~x) ^ (~n - 1) * (~a + ~c * (~x) ^ 2) ^ (~p + 1)) / (~d + ~e * ~x), ~x) + (1 / (~c * (~d) ^ 2 + ~a * (~e) ^ 2)) * Antiderivative((~f + ~g * ~x) ^ (~n - 1) * ((~c * ~d * ~f + ~a * ~e * ~g) - ~c * (~e * ~f - ~d * ~g) * ~x) * (~a + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~n)) && (Not(IntegerQ(~p)) && (LtQ(~p, -1) && GtQ(~n, 0))))))
    @apply_utils Antiderivative((~(f') + ~(g') * ~x) ^ ~n / ((~(d') + ~(e') * ~x) * sqrt(~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2)), ~x) => Antiderivative(ExpandIntegrand(1 / (sqrt(~f + ~g * ~x) * sqrt(~a + ~b * ~x + ~c * (~x) ^ 2)), (~f + ~g * ~x) ^ (~n + 1 / 2) / (~d + ~e * ~x), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && IntegerQ(~n + 1 / 2))))
    @apply_utils Antiderivative((~(f') + ~(g') * ~x) ^ ~n / ((~(d') + ~(e') * ~x) * sqrt(~a + ~(c') * (~x) ^ 2)), ~x) => Antiderivative(ExpandIntegrand(1 / (sqrt(~f + ~g * ~x) * sqrt(~a + ~c * (~x) ^ 2)), (~f + ~g * ~x) ^ (~n + 1 / 2) / (~d + ~e * ~x), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && IntegerQ(~n + 1 / 2)))
    @apply_utils Antiderivative(((~(g') * ~x) ^ ~(n') * (~a + ~(c') * (~x) ^ 2) ^ ~p) / (~d + ~(e') * ~x), ~x) => ((~d * (~g * ~x) ^ ~n) / (~x) ^ ~n) * Antiderivative(((~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ ~p) / ((~d) ^ 2 - (~e) ^ 2 * (~x) ^ 2), ~x) - ((~e * (~g * ~x) ^ ~n) / (~x) ^ ~n) * Antiderivative(((~x) ^ (~n + 1) * (~a + ~c * (~x) ^ 2) ^ ~p) / ((~d) ^ 2 - (~e) ^ 2 * (~x) ^ 2), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~g, ~n, ~p], ~x) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (Not(IntegerQ(~p)) && Not(IntegersQ(~n, 2 * ~p))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => Antiderivative(ExpandIntegrand((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && (NeQ((~c * (~d) ^ 2 - ~b * ~d * ~e) + ~a * (~e) ^ 2, 0) && ((IntegerQ(~p) || ILtQ(~m, 0) && ILtQ(~n, 0)) && Not(IGtQ(~m, 0) || IGtQ(~n, 0))))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~(p'), ~x) => Antiderivative(ExpandIntegrand((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ ~p, ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ(~e * ~f - ~d * ~g, 0) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && ((IntegerQ(~p) || ILtQ(~m, 0) && ILtQ(~n, 0)) && Not(IGtQ(~m, 0) || IGtQ(~n, 0)))))
    @apply_utils Antiderivative((~(g') * ~x) ^ ~(n') * (~d + ~(e') * ~x) ^ ~m * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => ((~g * ~x) ^ ~n / (~x) ^ ~n) * Antiderivative(ExpandIntegrand((~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ ~p, (~d / ((~d) ^ 2 - (~e) ^ 2 * (~x) ^ 2) - (~e * ~x) / ((~d) ^ 2 - (~e) ^ 2 * (~x) ^ 2)) ^ -(~m), ~x), ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~g, ~n, ~p], ~x) && (NeQ(~c * (~d) ^ 2 + ~a * (~e) ^ 2, 0) && (ILtQ(~m, 0) && (Not(IntegerQ(~p)) && Not(IntegerQ(~n)))))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~(a') + ~(b') * ~x + ~(c') * (~x) ^ 2) ^ ~p, ~x) => Unintegrable((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && Not(IGtQ(~m, 0) || IGtQ(~n, 0))
    @apply_utils Antiderivative((~(d') + ~(e') * ~x) ^ ~m * (~(f') + ~(g') * ~x) ^ ~n * (~a + ~(c') * (~x) ^ 2) ^ ~p, ~x) => Unintegrable((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ ~p, ~x) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && Not(IGtQ(~m, 0) || IGtQ(~n, 0))
    @apply_utils Antiderivative((~(d') + ~(e') * ~u) ^ ~(m') * (~(f') + ~(g') * ~u) ^ ~(n') * (~a + ~(b') * ~u + ~(c') * (~u) ^ 2) ^ ~(p'), ~x) => (1 / Coefficient(~u, ~x, 1)) * Subst(Antiderivative((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~b * ~x + ~c * (~x) ^ 2) ^ ~p, ~x), ~x, ~u) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (LinearQ(~u, ~x) && NeQ(~u, ~x))
    @apply_utils Antiderivative((~(d') + ~(e') * ~u) ^ ~(m') * (~(f') + ~(g') * ~u) ^ ~(n') * (~a + ~(c') * (~u) ^ 2) ^ ~(p'), ~x) => (1 / Coefficient(~u, ~x, 1)) * Subst(Antiderivative((~d + ~e * ~x) ^ ~m * (~f + ~g * ~x) ^ ~n * (~a + ~c * (~x) ^ 2) ^ ~p, ~x), ~x, ~u) <-- FreeQ([~a, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (LinearQ(~u, ~x) && NeQ(~u, ~x))
end

max_stars_repo_path: src/rules/1 Algebraic functions/1.2 Trinomial products/1.2.1 Quadratic/1.2.1.4 (d+e x)^m (f+g x)^n (a+b x+c x^2)^p.jl


text:
version_sum, bits = 0, join(reverse(digits(parse(BigInt, "1"*readline(), base=16), base=2))[2:end])
function parse_packet(index)  # index is the current index in `bits` string, list of single integer
    take_int(count) = parse(Int, bits[index[1]:((index[1]+=count)-1)], base=2)
    global version_sum += take_int(3)
    id, c = take_int(3), true
    id == 4 && return reduce((a,b)->16a+b, [take_int(4) for _=1:99 if c == 1 && (c = take_int(1)) < 2])
    apply_op(values) = reduce([+, *, min, max, id, >, <, ==][id + 1], values)
    if take_int(1) == 0 && (target_index = take_int(15) + index[1]) != 0
        return [parse_packet(index) for _=1:99 if index[1] < target_index] |> apply_op
    else
        return [parse_packet(index) for _=1:take_int(11)] |> apply_op
    end
end
parse_packet([1]) |> val -> println("$version_sum\n$val") # |> so that sum can be printed before val

ext: jl

max_stars_repo_name: LiquidFun/adventofcode

max_issues_repo_name: LiquidFun/adventofcode

max_forks_repo_name: LiquidFun/adventofcode


text:
# Use baremodule to shave off a few KB from the serialized `.ji` file
baremodule ColPack_jll
using Base
using Base: UUID
import JLLWrappers

JLLWrappers.@generate_main_file_header("ColPack")
JLLWrappers.@generate_main_file("ColPack", UUID("f218ff0c-cb54-5151-80c4-c0f62c730ce6"))
end  # module ColPack_jll


text:
mutable struct LinQuadSOS
    kind::Symbol
    weights::Vector{Float64}
    indices::Vector{Int}
end

mutable struct MockLinQuadModel # <: LinQuadOptInterface.LinQuadOptimizer

    sense::Symbol

    A::Matrix{Float64}
    b::Vector{Float64}
    c::Vector{Float64}

    #Q::SparseVector{Matrix{Float64}}

    range::Vector{Float64} # constraint UB for range

    lb::Vector{Float64}
    ub::Vector{Float64}

    vartype::Vector{Cchar} # :Bin, :Int, :Con
    contype::Vector{Cchar} # :LEQ :GEQ, :EQ, :RANGE

    # sos::LinQuadSOS{LinQuadSOS}

    termination_status::MOI.TerminationStatusCode
    primal_status::MOI.ResultStatusCode
    dual_status::MOI.ResultStatusCode

    variable_primal_solution::Vector{Float64}
    variable_dual_solution::Vector{Float64}

    constraint_primal_solution::Vector{Float64}
    constraint_dual_solution::Vector{Float64}
    function MockLinQuadModel(env::Void,str::String="defaultname")
        m = new()

        m.sense = :minimize

        m.A = zeros(0,0)
        m.b = zeros(0)
        m.c = zeros(0)

        m.range = zeros(0)

        m.lb = zeros(0)
        m.ub = zeros(0)

        m.vartype = Cchar[]
        m.contype = Cchar[]

        m.termination_status = MOI.Success
        m.primal_status = MOI.FeasiblePoint
        m.dual_status = MOI.FeasiblePoint

        m.variable_primal_solution = zeros(0)
        m.variable_dual_solution = zeros(0)

        m.constraint_primal_solution = zeros(0)
        m.constraint_dual_solution = zeros(0)

        return m
    end
end
num_vars(inner::MockLinQuadModel) = length(inner.c)
num_cons(inner::MockLinQuadModel) = length(inner.rhs)

function set_variable_primal_solution!(inner::MockLinQuadModel,input::Vector)
    m.variable_primal_solution = input
end
function set_variable_dual_solution!(inner::MockLinQuadModel,input::Vector)
    m.variable_dual_solution = input
end
function set_constraint_primal_solution!(inner::MockLinQuadModel,input::Vector)
    m.constraint_primal_solution = input
end
function set_constraint_dual_solution!(inner::MockLinQuadModel,input::Vector)
    m.constraint_dual_solution = input
end
function set_termination_status!(inner::MockLinQuadModel,input)
    m.termination_status = input
end
function set_primal_status!(inner::MockLinQuadModel,input)
    m.primal_status = input
end
function set_dual_status!(inner::MockLinQuadModel,input)
    m.dual_status = input
end

const LQOI = LinQuadOptInterface
const MOI  = LQOI.MOI

const SUPPORTED_OBJECTIVES = [
    LQOI.Linear,
    #LQOI.Quad
]

const SUPPORTED_CONSTRAINTS = [
    (LQOI.Linear, LQOI.EQ),
    (LQOI.Linear, LQOI.LE),
    (LQOI.Linear, LQOI.GE),
    (Linear, IV),
    #(LQOI.Quad, LQOI.EQ),
    #(LQOI.Quad, LQOI.LE),
    #(LQOI.Quad, LQOI.GE),
    (LQOI.SinVar, LQOI.EQ),
    (LQOI.SinVar, LQOI.LE),
    (LQOI.SinVar, LQOI.GE),
    (LQOI.SinVar, LQOI.IV),
    (LQOI.SinVar, MOI.ZeroOne),
    (LQOI.SinVar, MOI.Integer),
    #(LQOI.VecVar, LQOI.SOS1),
    #(LQOI.VecVar, LQOI.SOS2),
    (LQOI.VecVar, MOI.Nonnegatives),
    (LQOI.VecVar, MOI.Nonpositives),
    (LQOI.VecVar, MOI.Zeros),
    (LQOI.VecLin, MOI.Nonnegatives),
    (LQOI.VecLin, MOI.Nonpositives),
    (LQOI.VecLin, MOI.Zeros)
]

mutable struct MockLinQuadOptimizer <: LQOI.LinQuadOptimizer
    LQOI.@LinQuadOptimizerBase
    params::Dict{String,Any}
    MockLinQuadOptimizer(::Void) = new()
end

LQOI.LinearQuadraticModel(::Type{MockLinQuadOptimizer},env::Void) = MockLinQuadModel(env,"defaultname")

function MockLinQuadOptimizer(;kwargs...)

    m = MockLinQuadOptimizer(nothing)
    m.params = Dict{String,Any}()
    MOI.empty!(m)
    for (name,value) in kwargs
        m.params[string(name)] = value
        setparam!(m.inner, string(name), value)
    end
    return m
end

function MOI.empty!(m::MockLinQuadOptimizer)
    MOI.empty!(m,nothing)
    for (name,value) in m.params
        setparam!(m.inner, name, value)
    end
end

LQOI.supported_constraints(s::MockLinQuadOptimizer) = SUPPORTED_CONSTRAINTS
LQOI.supported_objectives(s::MockLinQuadOptimizer) = SUPPORTED_OBJECTIVES

cintvec(v::Vector) = convert(Vector{Int32}, v)

LQOI.backend_type(m::MockLinQuadOptimizer, ::MOI.EqualTo{Float64})     = Cchar('E')#Cchar('=')
LQOI.backend_type(m::MockLinQuadOptimizer, ::MOI.LessThan{Float64})    = Cchar('L')#Cchar('<')
LQOI.backend_type(m::MockLinQuadOptimizer, ::MOI.GreaterThan{Float64}) = Cchar('G')#Cchar('>')
LQOI.backend_type(m::MockLinQuadOptimizer, ::MOI.Zeros)                = Cchar('E')#Cchar('=')
LQOI.backend_type(m::MockLinQuadOptimizer, ::MOI.Nonpositives)         = Cchar('L')#Cchar('<')
LQOI.backend_type(m::MockLinQuadOptimizer, ::MOI.Nonnegatives)         = Cchar('G')#Cchar('>')

# TODO - improve single type
function LQOI.change_variable_bounds!(instance::MockLinQuadOptimizer, colvec, valvec, sensevec)
    # colvec = colvec+1

    lb_len = count(x->x==Cchar('L'), sensevec)
    LB_val = Array{Float64}(0)
    sizehint!(LB_val, lb_len)
    LB_col = Array{Cint}(0)
    sizehint!(LB_col, lb_len)

    ub_len = count(x->x==Cchar('G'), sensevec)
    UB_val = Array{Float64}(0)
    sizehint!(UB_val, ub_len)
    UB_col = Array{Cint}(0)
    sizehint!(UB_col, ub_len)

    for i in eachindex(valvec)
        if sensevec[i] == Cchar('L')
            push!(LB_col, colvec[i])
            push!(LB_val, valvec[i])
        elseif sensevec[i] == Cchar('G')
            push!(UB_col, colvec[i])
            push!(UB_val, valvec[i])
        end
    end

    if lb_len > 0
        for i in eachindex(LB_col)
            instance.inner.lb[LB_col[i]] = LB_val[i]
        end
    end

    if ub_len > 0
        for i in eachindex(UB_col)
            instance.inner.ub[UB_col[i]] = UB_val[i]
        end
    end

    nothing
end

function LQOI.get_variable_lowerbound(instance::MockLinQuadOptimizer, col)
    instance.inner.lb[col]
end

function LQOI.get_variable_upperbound(instance::MockLinQuadOptimizer, col)
    instance.inner.ub[col]
end

function LQOI.get_number_linear_constraints(instance::MockLinQuadOptimizer)
    size(instance.inner.A)[1]
end

function LQOI.add_linear_constraints!(instance::MockLinQuadOptimizer, rowvec, colvec, coefvec, sensevec, rhsvec)

    rows = length(rhsvec)
    cols = size(instance.inner.A)[2]
    push!(rowvec,length(colvec)+1)

    # An = full(sparse(rowvec,colvec,coefvec,rows,cols))
    # @show cols,rows,rowvec,colvec,coefvec
    An = full(SparseMatrixCSC(cols,rows,rowvec,colvec,coefvec)')

    instance.inner.A = vcat(instance.inner.A,An)

    append!(instance.inner.b,rhsvec)
    append!(instance.inner.contype,sensevec)

    append!(instance.inner.range,[Inf for i in 1:rows])
    nothing
end

function LQOI.add_ranged_constraints!(instance::MockLinQuadOptimizer, rowvec, colvec, coefvec, rhsvec, ubvec)
    rows = length(rhsvec)
    cols = size(instance.inner.A)[2]
    push!(rowvec,length(colvec)+1)

    # An = full(sparse(rowvec,colvec,coefvec,rows,cols))
    # @show cols,rows,rowvec,colvec,coefvec
    An = full(SparseMatrixCSC(cols,rows,rowvec,colvec,coefvec)')

    instance.inner.A = vcat(instance.inner.A,An)

    append!(instance.inner.b,rhsvec)
    append!(instance.inner.contype,['R' for i in 1:rows])

    append!(instance.inner.range,ubvec)

    nothing
end

function modify_ranged_constraints!(instance::MockLinQuadOptimizer, rows, rhsvec, ubvec)
    for i in rows
        instance.inner.b[i] = rhsvec[i]
        instance.inner.range[i] = ubvec[i]
    end
    nothing
end

function LQOI.get_rhs(instance::MockLinQuadOptimizer, row)
    instance.inner.b[row]
end

function LQOI.get_linear_constraint(instance::MockLinQuadOptimizer, idx)
    vals = instance.inner.A[idx,:]

    outvals = Float64[]
    outinds = Int[]
    for i in eachindex(vals)
        if abs(vals[i]) > 0.0
            push!(outvals,vals[i])
            push!(outinds,i-1)
        end
    end
    return outinds, outvals
end

# TODO SPLIT THIS ONE
function LQOI.change_coefficient!(instance::MockLinQuadOptimizer, row, col, coef)
    # if row == 0
    #     set_dblattrlist!(instance.inner, "Obj", Cint[col], Float64[coef])
    # elseif col == 0
    #     set_dblattrlist!(instance.inner, "RHS", Cint[row], Float64[coef])
    # else
    #     chg_coeffs!(instance.inner, row, col, coef)
    #     #TODO fix this function in gurobi
    # end
end

function LQOI.delete_linear_constraints!(instance::MockLinQuadOptimizer, rowbeg, rowend)
    if rowbeg > 1 && rowend < length(instance.inner.b)
        instance.inner.A = vcat(instance.inner.A[1:rowbeg-1,:],instance.inner.A[rowend+1:end,:])
        instance.inner.b = vcat(instance.inner.b[1:rowbeg-1],instance.inner.b[rowend+1:end])
        instance.inner.contype = vcat(instance.inner.contype[1:rowbeg-1],instance.inner.contype[rowend+1:end])
        instance.inner.range = vcat(instance.inner.range[1:rowbeg-1],instance.inner.range[rowend+1:end])
    elseif rowbeg > 1
        instance.inner.A = instance.inner.A[1:rowbeg-1,:]
        instance.inner.b = instance.inner.b[1:rowbeg-1]
        instance.inner.contype = instance.inner.contype[1:rowbeg-1]
        instance.inner.range = instance.inner.range[1:rowbeg-1]
    elseif rowend < length(instance.inner.b)
        instance.inner.A = instance.inner.A[rowend+1:end,:]
        instance.inner.b = instance.inner.b[rowend+1:end]
        instance.inner.contype = instance.inner.contype[rowend+1:end]
        instance.inner.range = instance.inner.range[rowend+1:end]
    else
        instance.inner.A = zeros(0,length(instance.inner.c))
        instance.inner.b = Vector{Float64}[]
        instance.inner.contype = Cchar[]
        instance.inner.range = Vector{Float64}[]
    end
end

# TODO fix types
function variabletype(::MockLinQuadOptimizer, typeval)
    if typeval == 'B'
        return 'B'
    elseif typeval == 'I'
        return 'I'
    else
        return 'C'
    end
end
function LQOI.change_variable_types!(instance::MockLinQuadOptimizer, colvec, typevec)
    for i in eachindex(colvec)
        instance.inner.vartype[colvec[i]] = variabletype(instance, typevec[i])
    end
end

function sensetype(::MockLinQuadOptimizer, typeval)
    if typeval == 'G'
        return 'G'
    elseif typeval == 'E'
        return 'E'
    elseif typeval == 'L'
        return 'L'
    else
        return 'R'
    end
end
function LQOI.change_linear_constraint_sense!(instance::MockLinQuadOptimizer, rowvec, sensevec)
    for i in eachindex(rowvec)
        instance.inner.vartype[rowvec[i]] = sensetype(instance, sensevec[i])
    end
end

#=
LQOI.add_sos_constraint!(instance::MockLinQuadOptimizer, colvec, valvec, typ) = (add_sos!(instance.inner, typ, colvec, valvec);update_model!(instance.inner))

LQOI.delete_sos!(instance::MockLinQuadOptimizer, idx1, idx2) = (del_sos!(instance.inner, cintvec(collect(idx1:idx2)));update_model!(instance.inner))

# TODO improve getting processes
function LQOI.get_sos_constraint(instance::MockLinQuadOptimizer, idx)
    A, types = get_sos_matrix(instance.inner)
    line = A[idx,:] #sparse vec
    cols = line.nzind
    vals = line.nzval
    typ = types[idx] == Cint(1) ? :SOS1 : :SOS2
    return cols, vals, typ
end

LQOI.get_number_quadratic_constraints(instance::MockLinQuadOptimizer) = num_qconstrs(instance.inner)

#   NOTE:
# LQOI assumes 0.5 x' Q x, but Gurobi requires x' Q x so we multiply V by 0.5
LQOI.add_quadratic_constraint!(instance::MockLinQuadOptimizer, cols,coefs,rhs,sense, I,J,V) = add_qconstr!(instance.inner, cols, coefs, I, J, 0.5 * V, sense, rhs)

# LQOI.change_range_value!(instance::MockLinQuadOptimizer, rows, vals) = chg_rhsrange!(instance.inner, cintvec(rows), -vals)

# function LQOI.set_quadratic_objective!(instance::MockLinQuadOptimizer, I, J, V)
#     delq!(instance.inner)
#     for i in eachindex(V)
#         if I[i] == J[i]
#             V[i] /= 2
#         end
#     end
#     add_qpterms!(instance.inner, I, J, V)
#     return nothing
# end
=#

function LQOI.set_linear_objective!(instance::MockLinQuadOptimizer, colvec, coefvec)
    nvars = num_vars(instance.inner)
    obj = zeros(Float64, nvars)

    for i in eachindex(colvec)
        obj[colvec[i]] = coefvec[i]
    end

    instance.inner.c = obj
    nothing
end

function LQOI.change_objective_sense!(instance::MockLinQuadOptimizer, symbol)
    if symbol == :min
        instance.inner.sense = :minimize
    else
        instance.inner.sense = :maximize
    end
end

function LQOI.get_linear_objective!(instance::MockLinQuadOptimizer, x)
    for i in eachindex(x)
        x[i] = instance.inner.c[i]
    end
end

function LQOI.get_objectivesense(instance::MockLinQuadOptimizer)
    s = instance.inner.sense
    if s == :maximize
        return MOI.MaxSense
    else
        return MOI.MinSense
    end
end

LQOI.get_number_variables(instance::MockLinQuadOptimizer) = length(instance.inner.c)

function LQOI.add_variables!(instance::MockLinQuadOptimizer, int)
    append!(instance.inner.ub,Inf*ones(int))
    append!(instance.inner.lb,-Inf*ones(int))
    append!(instance.inner.c,0.0*ones(int))
    append!(instance.inner.vartype,['C' for i in 1:int])
    instance.inner.A = hcat(instance.inner.A,zeros(length(instance.inner.b),int))
end

function LQOI.delete_variables!(instance::MockLinQuadOptimizer, colbeg, colend)
    if colbeg > 1 && colend < length(instance.inner.lb)
        instance.inner.A = hcat(instance.inner.A[:,1:colbeg-1],instance.inner.A[:,colend+1:end])
        instance.inner.lb = vcat(instance.inner.lb[1:colbeg-1],instance.inner.lb[colend+1:end])
        instance.inner.ub = vcat(instance.inner.ub[1:colbeg-1],instance.inner.ub[colend+1:end])
        instance.inner.c = vcat(instance.inner.c[1:colbeg-1],instance.inner.c[colend+1:end])
        instance.inner.vartype = vcat(instance.inner.vartype[1:colbeg-1],instance.inner.vartype[colend+1:end])
    elseif colbeg > 1
        instance.inner.A = instance.inner.A[:,1:colbeg-1]
        instance.inner.lb = instance.inner.lb[1:colbeg-1]
        instance.inner.ub = instance.inner.ub[1:colbeg-1]
        instance.inner.c = instance.inner.c[1:colbeg-1]
        instance.inner.vartype = instance.inner.vartype[1:colbeg-1]
    elseif colend < length(instance.inner.lb)
        instance.inner.A = instance.inner.A[:,colend+1:end]
        instance.inner.lb = instance.inner.lb[colend+1:end]
        instance.inner.ub = instance.inner.ub[colend+1:end]
        instance.inner.c = instance.inner.c[colend+1:end]
        instance.inner.vartype = instance.inner.vartype[colend+1:end]
    else
        instance.inner.A = zeros(length(instance.inner.b),0)
        instance.inner.lb = Vector{Float64}[]
        instance.inner.ub = Vector{Float64}[]
        instance.inner.cß = Vector{Float64}[]
        instance.inner.vartype = Cchar[]
    end
end

# function LQOI.add_mip_starts!(instance::MockLinQuadOptimizer, colvec::Vector{Int}, valvec::Vector)
#     x = zeros(num_vars(instance.inner))
#     for (col, val) in zip(colvec, valvec)
#         x[col] = val
#     end
#     loadbasis(instance.inner, x)
# end

LQOI.solve_mip_problem!(instance::MockLinQuadOptimizer) = nothing

LQOI.solve_quadratic_problem!(instance::MockLinQuadOptimizer) = nothing

LQOI.solve_linear_problem!(instance::MockLinQuadOptimizer) = nothing

function LQOI.get_termination_status(instance::MockLinQuadOptimizer)
    return MOI.Success
end

function LQOI.get_primal_status(instance::MockLinQuadOptimizer)
    return MOI.FeasiblePoint
end

function LQOI.get_dual_status(instance::MockLinQuadOptimizer)
    return MOI.FeasiblePoint
end

function LQOI.get_variable_primal_solution!(instance::MockLinQuadOptimizer, place)
    for i in eachindex(place)
        place[i] = instance.inner.variable_primal_solution[i]
    end
    nothing
end

function LQOI.get_linear_primal_solution!(instance::MockLinQuadOptimizer, place)
    # Fix QUADRATICS
    for i in eachindex(place)
        place[i] = instance.inner.constraint_primal_solution[i]
    end
    nothing
end

#=
function LQOI.get_quadratic_primal_solution!(instance::MockLinQuadOptimizer, place)
    get_dblattrarray!(place, instance.inner, "QCSlack", 1)
    rhs = get_dblattrarray(instance.inner, "QCRHS", 1, num_qconstrs(instance.inner))
    for i in eachindex(place)
        place[i] = -place[i]+rhs[i]
    end
    nothing
end
=#

function LQOI.get_variable_dual_solution!(instance::MockLinQuadOptimizer, place)
    for i in eachindex(place)
        place[i] = instance.inner.variable_dual_solution[i]
    end
    nothing
end

function LQOI.get_linear_dual_solution!(instance::MockLinQuadOptimizer, place)
    # Fix QUADRATICS
    for i in eachindex(place)
        place[i] = instance.inner.constraint_dual_solution[i]
    end
    nothing
end

#LQOI.get_quadratic_dual_solution!(instance::MockLinQuadOptimizer, place) = get_dblattrarray!(place, instance.inner, "QCPi", 1)

LQOI.get_objective_value(instance::MockLinQuadOptimizer) = get_objval(instance.inner)

#=
LQOI.get_objective_bound(instance::MockLinQuadOptimizer) = get_objval(instance.inner)

function LQOI.get_relative_mip_gap(instance::MockLinQuadOptimizer)
    L = get_objval(instance.inner)
    U = get_objbound(instance.inner)
    return abs(U-L)/U
end

LQOI.get_iteration_count(instance::MockLinQuadOptimizer)  = get_iter_count(instance.inner)

LQOI.get_barrier_iterations(instance::MockLinQuadOptimizer) = get_barrier_iter_count(instance.inner)

LQOI.get_node_count(instance::MockLinQuadOptimizer) = get_node_count(instance.inner)
=#
#=
LQOI.get_farkas_dual!(instance::MockLinQuadOptimizer, place) = get_dblattrarray!(place, instance.inner, "FarkasDual", 1)

function hasdualray(instance::MockLinQuadOptimizer)
    try
        get_dblattrarray(instance.inner, "FarkasDual", 1, num_constrs(instance.inner))
        return true
    catch
        return false
    end
end

LQOI.get_unbounded_ray!(instance::MockLinQuadOptimizer, place) = get_dblattrarray!(place, instance.inner, "UnbdRay", 1)

function hasprimalray(instance::MockLinQuadOptimizer)
    try
        get_dblattrarray(instance.inner, "UnbdRay", 1, num_vars(instance.inner))
        return true
    catch
        return false
    end
end
=#
MOI.free!(m::MockLinQuadOptimizer) = nothing


text:
using EEG
using Base.Test
using Logging
using Private

fname = joinpath(dirname(@__FILE__), "../data", "test_Hz19.5-testing.bdf")

s = read_SSR(fname)

s.modulationrate = 40

s = rereference(s, "Cz")

s = extract_epochs(s)

s = hotelling(s)

# Values checked against biopil

@test_approx_eq_eps s.processing["statistics"][:SignalPhase][2:end] [-2.0242503747 1.0592243553 0.1241683641 0.4413366056 -0.6632078384] 0.01

@test_approx_eq_eps s.processing["statistics"][:SignalAmplitude][2:end] sqrt([0.0245292215 0.0139141820 0.7170930945 0.0121231951  0.0419922102]) 0.001

@test_approx_eq_eps s.processing["statistics"][:NoiseAmplitude][2:end] sqrt([0.1625531784 0.1624553511 0.2744051671 0.1951633702  0.2178213209]) 0.001

@test_approx_eq_eps s.processing["statistics"][:Statistic][2:end] [0.8264963627 0.8860469460 0.0565369725 0.9547960758 0.7870649099] 0.001

@test_approx_eq_eps s.processing["statistics"][:SNRdB][2:end] 10*log10([0.1508996733 0.0856492686 2.6132638177 0.0621181890  0.1927828278]) 0.001

# old syntax
s = hotelling(s, 20)

# Values not checked against MATLAB, just checking they dont change
@test_approx_eq_eps s.processing["statistics"][:SNRdB][2:end] [-8.213117489375172,-10.672763757064203,4.171832757032964,-12.067811128392261,-7.149317198518387,NaN,2.6057187061929428,0.31160350083134575,-0.4669094337860864,-2.8021086381963705,-4.159205467185502] 0.001


text:
using VortexDistributions, Test

# @testset "Point vortex " begin

# unitary
v0 = [.2 .4 1]
w0 = PointVortex(v0)
@test vortex_array(w0) == v0

v1 = [.2 .4 1;0.7 1.5 -1;-.3 1.2 1]
w1 = PointVortex(v1)
@test vortex_array(w1) == v1

w3 = rand_pointvortex(1000)
v3 = vortex_array(w3)
@test v3 == vortex_array(w3)
# end


text:
using Pkg
Pkg.activate(@__DIR__)
Pkg.develop(path=dirname(@__DIR__)) # Add RediSearch if not already added. This will update Project.toml

using Documenter, DocumenterMarkdown, RediSearch

makedocs(
    sitename = "RediSearch.jl",
    modules  = [RediSearch],
    authors  = "Jackson Calvert-Lane",
    pages    = [
                "Home" => "index.md"
               ]
    )

deploydocs(repo="github.com/jacksoncalvert/RediSearch.jl.git",)