int_rules_4_1_2_2 = @theory begin

    #= ::Subsection::Closed:: =#
    #= 4.1.2.2*(g*cos)^p*(a+b*sin)^m*(c+d*sin)^n =#
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => (1 / (~b * ~f)) * Subst(Antiderivative((~a + ~x) ^ ~m * (~c + (~d / ~b) * ~x) ^ ~n, ~x), ~x, ~b * sin(~e + ~f * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n], ~x)
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(n') * (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => ~a * Antiderivative(cos(~e + ~f * ~x) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ ~n, ~x) + (~b / ~d) * Antiderivative(cos(~e + ~f * ~x) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ (~n + 1), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~n, ~p], ~x) && (IntegerQ((~p - 1) / 2) && (IntegerQ(~n) && (LtQ(~p, 0) && NeQ((~a) ^ 2 - (~b) ^ 2, 0) || (LtQ(0, ~n, ~p - 1) || LtQ(~p + 1, -(~n), 2 * ~p + 1)))))
    @apply_utils Antiderivative((cos(~(e') + ~(f') * ~x) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(n')) / (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => (1 / ~a) * Antiderivative(cos(~e + ~f * ~x) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ ~n, ~x) - (1 / (~b * ~d)) * Antiderivative(cos(~e + ~f * ~x) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~n, ~p], ~x) && (IntegerQ((~p - 1) / 2) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegerQ(~n) && (LtQ(0, ~n, (~p + 1) / 2) || (LeQ(~p, -(~n)) && LtQ(-(~n), 2 * ~p - 3) || GtQ(~n, 0) && LeQ(~n, -(~p)))))))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => (1 / ((~b) ^ ~p * ~f)) * Subst(Antiderivative((~a + ~x) ^ (~m + (~p - 1) / 2) * (~a - ~x) ^ ((~p - 1) / 2) * (~c + (~d / ~b) * ~x) ^ ~n, ~x), ~x, ~b * sin(~e + ~f * ~x)) <-- FreeQ([~a, ~b, ~e, ~f, ~c, ~d, ~m, ~n], ~x) && (IntegerQ((~p - 1) / 2) && EqQ((~a) ^ 2 - (~b) ^ 2, 0))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => (1 / ((~b) ^ ~p * ~f)) * Subst(Antiderivative((~a + ~x) ^ ~m * (~c + (~d / ~b) * ~x) ^ ~n * ((~b) ^ 2 - (~x) ^ 2) ^ ((~p - 1) / 2), ~x), ~x, ~b * sin(~e + ~f * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n], ~x) && (IntegerQ((~p - 1) / 2) && NeQ((~a) ^ 2 - (~b) ^ 2, 0))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(n') * (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => ~a * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ ~n, ~x) + (~b / ~d) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ (~n + 1), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g, ~n, ~p], ~x)
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(n')) / (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => ((~g) ^ 2 / ~a) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ ~n, ~x) - ((~g) ^ 2 / (~b * ~d)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && EqQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => (((~a) ^ ~m * (~c) ^ ~m) / (~g) ^ (2 * ~m)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (2 * ~m + ~p) * (~c + ~d * sin(~e + ~f * ~x)) ^ (~n - ~m), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegerQ(~m) && Not(IntegerQ(~n) && LtQ((~n) ^ 2, (~m) ^ 2)))))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => (1 / ((~a) ^ (~p / 2) * (~c) ^ (~p / 2))) * Antiderivative((~a + ~b * sin(~e + ~f * ~x)) ^ (~m + ~p / 2) * (~c + ~d * sin(~e + ~f * ~x)) ^ (~n + ~p / 2), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~n, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && IntegerQ(~p / 2)))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p / (sqrt(~a + ~(b') * sin(~(e') + ~(f') * ~x)) * sqrt(~c + ~(d') * sin(~(e') + ~(f') * ~x))), ~x) => ((~g * cos(~e + ~f * ~x)) / (sqrt(~a + ~b * sin(~e + ~f * ~x)) * sqrt(~c + ~d * sin(~e + ~f * ~x)))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p - 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && EqQ((~a) ^ 2 - (~b) ^ 2, 0))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (((~a) ^ IntPart(~m) * (~c) ^ IntPart(~m) * (~a + ~b * sin(~e + ~f * ~x)) ^ FracPart(~m) * (~c + ~d * sin(~e + ~f * ~x)) ^ FracPart(~m)) / ((~g) ^ (2 * IntPart(~m)) * (~g * cos(~e + ~f * ~x)) ^ (2 * FracPart(~m)))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (2 * ~m + ~p) / (~c + ~d * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (EqQ((2 * ~m + ~p) - 1, 0) && EqQ((~m - ~n) - 1, 0))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~b * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1) * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n) / (~f * ~g * ((~m - ~n) - 1)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (EqQ((2 * ~m + ~p) - 1, 0) && NeQ((~m - ~n) - 1, 0))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (-2 * ~b * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1) * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n) / (~f * ~g * (2 * ~n + ~p + 1)) - ((~b * ((2 * ~m + ~p) - 1)) / (~d * (2 * ~n + ~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1) * (~c + ~d * sin(~e + ~f * ~x)) ^ (~n + 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IGtQ(Simplify((~m + ~p / 2) - 1 / 2), 0) && (LtQ(~n, -1) && (NeQ(2 * ~n + ~p + 1, 0) && Not(ILtQ(Simplify(~m + ~n + ~p), 0) && GtQ(Simplify(2 * ~m + ~n + (3 * ~p) / 2 + 1), 0)))))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (-(~b) * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1) * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n) / (~f * ~g * (~m + ~n + ~p)) + ((~a * ((2 * ~m + ~p) - 1)) / (~m + ~n + ~p)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1) * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IGtQ(Simplify((~m + ~p / 2) - 1 / 2), 0) && (Not(LtQ(~n, -1)) && (Not(IGtQ(Simplify((~n + ~p / 2) - 1 / 2), 0) && GtQ(~m - ~n, 0)) && Not(ILtQ(Simplify(~m + ~n + ~p), 0) && GtQ(Simplify(2 * ~m + ~n + (3 * ~p) / 2 + 1), 0)))))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (((~a) ^ IntPart(~m) * (~c) ^ IntPart(~m) * (~a + ~b * sin(~e + ~f * ~x)) ^ FracPart(~m) * (~c + ~d * sin(~e + ~f * ~x)) ^ FracPart(~m)) / ((~g) ^ (2 * IntPart(~m)) * (~g * cos(~e + ~f * ~x)) ^ (2 * FracPart(~m)))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (2 * ~m + ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && EqQ(2 * ~m + ~p + 1, 0)))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~b * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n) / (~a * ~f * ~g * (~m - ~n)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (EqQ(~m + ~n + ~p + 1, 0) && NeQ(~m, ~n))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~b * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n) / (~a * ~f * ~g * (2 * ~m + ~p + 1)) + ((~m + ~n + ~p + 1) / (~a * (2 * ~m + ~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (ILtQ(Simplify(~m + ~n + ~p + 1), 0) && (NeQ(2 * ~m + ~p + 1, 0) && (SumSimplerQ(~m, 1) || Not(SumSimplerQ(~n, 1)))))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (-2 * ~b * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1) * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n) / (~f * ~g * (2 * ~n + ~p + 1)) - ((~b * ((2 * ~m + ~p) - 1)) / (~d * (2 * ~n + ~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1) * (~c + ~d * sin(~e + ~f * ~x)) ^ (~n + 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (GtQ(~m, 0) && (LtQ(~n, -1) && (NeQ(2 * ~n + ~p + 1, 0) && IntegersQ(2 * ~m, 2 * ~n, 2 * ~p))))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (-(~b) * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1) * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n) / (~f * ~g * (~m + ~n + ~p)) + ((~a * ((2 * ~m + ~p) - 1)) / (~m + ~n + ~p)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1) * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (GtQ(~m, 0) && (NeQ(~m + ~n + ~p, 0) && (Not(LtQ(0, ~n, ~m)) && IntegersQ(2 * ~m, 2 * ~n, 2 * ~p))))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~b * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n) / (~a * ~f * ~g * (2 * ~m + ~p + 1)) + ((~m + ~n + ~p + 1) / (~a * (2 * ~m + ~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (LtQ(~m, -1) && (NeQ(2 * ~m + ~p + 1, 0) && (Not(LtQ(~m, ~n, -1)) && IntegersQ(2 * ~m, 2 * ~n, 2 * ~p))))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (((~a) ^ IntPart(~m) * (~c) ^ IntPart(~m) * (~a + ~b * sin(~e + ~f * ~x)) ^ FracPart(~m) * (~c + ~d * sin(~e + ~f * ~x)) ^ FracPart(~m)) / ((~g) ^ (2 * IntPart(~m)) * (~g * cos(~e + ~f * ~x)) ^ (2 * FracPart(~m)))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (2 * ~m + ~p) * (~c + ~d * sin(~e + ~f * ~x)) ^ (~n - ~m), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && (EqQ(~b * ~c + ~a * ~d, 0) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (FractionQ(~m) || Not(FractionQ(~n)))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (-(~d) * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m) / (~f * ~g * (~m + ~p + 1)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && EqQ(~a * ~d * ~m + ~b * ~c * (~m + ~p + 1), 0))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (-((~b * ~c + ~a * ~d)) * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m) / (~a * ~f * ~g * (~p + 1)) + ((~b * (~a * ~d * ~m + ~b * ~c * (~m + ~p + 1))) / (~a * (~g) ^ 2 * (~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p + 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (GtQ(~m, -1) && LtQ(~p, -1)))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (-(~d) * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m) / (~f * ~g * (~m + ~p + 1)) + ((~a * ~d * ~m + ~b * ~c * (~m + ~p + 1)) / (~b * (~m + ~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IGtQ(Simplify((2 * ~m + ~p + 1) / 2), 0) && NeQ(~m + ~p + 1, 0)))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 2 * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (2 * (~b * ~c - ~a * ~d) * cos(~e + ~f * ~x) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / ((~b) ^ 2 * ~f * (2 * ~m + 3)) + (1 / ((~b) ^ 3 * (2 * ~m + 3))) * Antiderivative((~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 2) * ((~b * ~c + 2 * ~a * ~d * (~m + 1)) - ~b * ~d * (2 * ~m + 3) * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && LtQ(~m, -3 / 2))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 2 * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (~d * cos(~e + ~f * ~x) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 2)) / ((~b) ^ 2 * ~f * (~m + 3)) - (1 / ((~b) ^ 2 * (~m + 3))) * Antiderivative((~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * ((~b * ~d * (~m + 2) - ~a * ~c * (~m + 3)) + (~b * ~c * (~m + 3) - ~a * ~d * (~m + 4)) * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (GeQ(~m, -3 / 2) && LtQ(~m, 0)))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => ((~b * ~c - ~a * ~d) * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m) / (~a * ~f * ~g * (2 * ~m + ~p + 1)) + ((~a * ~d * ~m + ~b * ~c * (~m + ~p + 1)) / (~a * ~b * (2 * ~m + ~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && ((LtQ(~m, -1) || ILtQ(Simplify(~m + ~p), 0)) && NeQ(2 * ~m + ~p + 1, 0)))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (-(~d) * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m) / (~f * ~g * (~m + ~p + 1)) + ((~a * ~d * ~m + ~b * ~c * (~m + ~p + 1)) / (~b * (~m + ~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && NeQ(~m + ~p + 1, 0))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (-((~g * cos(~e + ~f * ~x)) ^ (~p + 1)) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~d + ~c * sin(~e + ~f * ~x))) / (~f * ~g * (~p + 1)) + (1 / ((~g) ^ 2 * (~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p + 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1) * Simp(~a * ~c * (~p + 2) + ~b * ~d * ~m + ~b * ~c * (~m + ~p + 2) * sin(~e + ~f * ~x), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (GtQ(~m, 0) && (LtQ(~p, -1) && (IntegerQ(2 * ~m) && Not(EqQ(~m, 1) && (NeQ((~c) ^ 2 - (~d) ^ 2, 0) && SimplerQ(~c + ~d * ~x, ~a + ~b * ~x)))))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (-(~d) * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m) / (~f * ~g * (~m + ~p + 1)) + (1 / (~m + ~p + 1)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1) * Simp(~a * ~c * (~m + ~p + 1) + ~b * ~d * ~m + (~a * ~d * ~m + ~b * ~c * (~m + ~p + 1)) * sin(~e + ~f * ~x), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~p], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (GtQ(~m, 0) && (Not(LtQ(~p, -1)) && (IntegerQ(2 * ~m) && Not(EqQ(~m, 1) && (NeQ((~c) ^ 2 - (~d) ^ 2, 0) && SimplerQ(~c + ~d * ~x, ~a + ~b * ~x)))))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (~g * (~g * cos(~e + ~f * ~x)) ^ (~p - 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * ((~b * ~c * (~m + ~p + 1) - ~a * ~d * ~p) + ~b * ~d * (~m + 1) * sin(~e + ~f * ~x))) / ((~b) ^ 2 * ~f * (~m + 1) * (~m + ~p + 1)) + (((~g) ^ 2 * (~p - 1)) / ((~b) ^ 2 * (~m + 1) * (~m + ~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * Simp(~b * ~d * (~m + 1) + (~b * ~c * (~m + ~p + 1) - ~a * ~d * ~p) * sin(~e + ~f * ~x), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (LtQ(~m, -1) && (GtQ(~p, 1) && (NeQ(~m + ~p + 1, 0) && IntegerQ(2 * ~m)))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (-((~b * ~c - ~a * ~d)) * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / (~f * ~g * ((~a) ^ 2 - (~b) ^ 2) * (~m + 1)) + (1 / (((~a) ^ 2 - (~b) ^ 2) * (~m + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * Simp((~a * ~c - ~b * ~d) * (~m + 1) - (~b * ~c - ~a * ~d) * (~m + ~p + 2) * sin(~e + ~f * ~x), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~p], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (LtQ(~m, -1) && IntegerQ(2 * ~m)))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (~g * (~g * cos(~e + ~f * ~x)) ^ (~p - 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * ((~b * ~c * (~m + ~p + 1) - ~a * ~d * ~p) + ~b * ~d * (~m + ~p) * sin(~e + ~f * ~x))) / ((~b) ^ 2 * ~f * (~m + ~p) * (~m + ~p + 1)) + (((~g) ^ 2 * (~p - 1)) / ((~b) ^ 2 * (~m + ~p) * (~m + ~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * Simp(~b * (~a * ~d * ~m + ~b * ~c * (~m + ~p + 1)) + (~a * ~b * ~c * (~m + ~p + 1) - ~d * ((~a) ^ 2 * ~p - (~b) ^ 2 * (~m + ~p))) * sin(~e + ~f * ~x), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (GtQ(~p, 1) && (NeQ(~m + ~p, 0) && (NeQ(~m + ~p + 1, 0) && IntegerQ(2 * ~m)))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => ((~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * ((~b * ~c - ~a * ~d) - (~a * ~c - ~b * ~d) * sin(~e + ~f * ~x))) / (~f * ~g * ((~a) ^ 2 - (~b) ^ 2) * (~p + 1)) + (1 / ((~g) ^ 2 * ((~a) ^ 2 - (~b) ^ 2) * (~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p + 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * Simp(~c * ((~a) ^ 2 * (~p + 2) - (~b) ^ 2 * (~m + ~p + 2)) + ~a * ~b * ~d * ~m + ~b * (~a * ~c - ~b * ~d) * (~m + ~p + 3) * sin(~e + ~f * ~x), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (LtQ(~p, -1) && IntegerQ(2 * ~m)))
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x))) / (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => (~d / ~b) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p, ~x) + ((~b * ~c - ~a * ~d) / ~b) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p / (~a + ~b * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g], ~x) && NeQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)), ~x) => ((~c * ~g * (~g * cos(~e + ~f * ~x)) ^ (~p - 1)) / (~f * (1 + sin(~e + ~f * ~x)) ^ ((~p - 1) / 2) * (1 - sin(~e + ~f * ~x)) ^ ((~p - 1) / 2))) * Subst(Antiderivative((1 + (~d / ~c) * ~x) ^ ((~p + 1) / 2) * (1 - (~d / ~c) * ~x) ^ ((~p - 1) / 2) * (~a + ~b * ~x) ^ ~m, ~x), ~x, sin(~e + ~f * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~p], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && EqQ((~c) ^ 2 - (~d) ^ 2, 0))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~a) ^ (2 * ~m) * Antiderivative((~d * sin(~e + ~f * ~x)) ^ ~n / (~a - ~b * sin(~e + ~f * ~x)) ^ ~m, ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(~m, ~p) && EqQ(2 * ~m + ~p, 0)))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * sin(~(e') + ~(f') * ~x) ^ 2 * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (-((~g * cos(~e + ~f * ~x)) ^ (~p + 1)) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / (2 * ~b * ~f * ~g * (~m + 1)) + (~a / (2 * (~g) ^ 2)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p + 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1), ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~g, ~m, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && EqQ(~m - ~p, 0))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * sin(~(e') + ~(f') * ~x) ^ 2 * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (~b * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m) / (~a * ~f * ~g * ~m) - (1 / (~g) ^ 2) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p + 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m, ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~g, ~m, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && EqQ(~m + ~p + 1, 0))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (1 / (~a) ^ ~p) * Antiderivative(ExpandTrig((~d * sin(~e + ~f * ~x)) ^ ~n * (~a - ~b * sin(~e + ~f * ~x)) ^ (~p / 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + ~p / 2), ~x), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(~m, ~n, ~p / 2) && (GtQ(~m, 0) && (GtQ(~p, 0) && LtQ(-(~m) - ~p, ~n, -1)) || GtQ(~m, 2) && (LtQ(~p, 0) && GtQ(~m + ~p / 2, 0)))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => Antiderivative(ExpandTrig((~g * cos(~e + ~f * ~x)) ^ ~p, (~d * sin(~e + ~f * ~x)) ^ ~n * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m, ~x), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && IGtQ(~m, 0))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 2 * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (1 / (~b) ^ 2) * Antiderivative((~d * sin(~e + ~f * ~x)) ^ ~n * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~a - ~b * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (ILtQ(~m, 0) || Not(IGtQ(~n, 0))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (~a / ~g) ^ (2 * ~m) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ (2 * ~m + ~p) * (~d * sin(~e + ~f * ~x)) ^ ~n) / (~a - ~b * sin(~e + ~f * ~x)) ^ ~m, ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && ILtQ(~m, 0))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (~a / ~g) ^ (2 * ~m) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ (2 * ~m + ~p) * (~d * sin(~e + ~f * ~x)) ^ ~n) / (~a - ~b * sin(~e + ~f * ~x)) ^ ~m, ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegerQ(~m) && (RationalQ(~p) && (EqQ(2 * ~m + ~p, 0) || GtQ(2 * ~m + ~p, 0) && LtQ(~p, -1)))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * sin(~(e') + ~(f') * ~x) ^ 2 * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (~b * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m) / (~a * ~f * ~g * (2 * ~m + ~p + 1)) - (1 / ((~a) ^ 2 * (2 * ~m + ~p + 1))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~a * ~m - ~b * (2 * ~m + ~p + 1) * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~g, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (LeQ(~m, -1 / 2) && NeQ(2 * ~m + ~p + 1, 0)))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * sin(~(e') + ~(f') * ~x) ^ 2 * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (-((~g * cos(~e + ~f * ~x)) ^ (~p + 1)) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / (~b * ~f * ~g * (~m + ~p + 2)) + (1 / (~b * (~m + ~p + 2))) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~b * (~m + 1) - ~a * (~p + 1) * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~g, ~m, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && NeQ(~m + ~p + 2, 0))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 2 * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (1 / (~b) ^ 2) * Antiderivative((~d * sin(~e + ~f * ~x)) ^ ~n * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~a - ~b * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && IntegersQ(2 * ~m, 2 * ~n))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 4 * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (-2 / (~a * ~b * ~d)) * Antiderivative((~d * sin(~e + ~f * ~x)) ^ (~n + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 2), ~x) + (1 / (~a) ^ 2) * Antiderivative((~d * sin(~e + ~f * ~x)) ^ ~n * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 2) * (1 + sin(~e + ~f * ~x) ^ 2), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && LtQ(~m, -1))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 4 * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (1 / (~d) ^ 4) * Antiderivative((~d * sin(~e + ~f * ~x)) ^ (~n + 4) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m, ~x) + Antiderivative((~d * sin(~e + ~f * ~x)) ^ ~n * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (1 - 2 * sin(~e + ~f * ~x) ^ 2), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && Not(IGtQ(~m, 0)))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (((~a) ^ ~m * cos(~e + ~f * ~x)) / (~f * sqrt(1 + sin(~e + ~f * ~x)) * sqrt(1 - sin(~e + ~f * ~x)))) * Subst(Antiderivative((~d * ~x) ^ ~n * (1 + (~b / ~a) * ~x) ^ (~m + (~p - 1) / 2) * (1 - (~b / ~a) * ~x) ^ ((~p - 1) / 2), ~x), ~x, sin(~e + ~f * ~x)) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegerQ(~p / 2) && IntegerQ(~m)))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (cos(~e + ~f * ~x) / ((~a) ^ (~p - 2) * ~f * sqrt(~a + ~b * sin(~e + ~f * ~x)) * sqrt(~a - ~b * sin(~e + ~f * ~x)))) * Subst(Antiderivative((~d * ~x) ^ ~n * (~a + ~b * ~x) ^ ((~m + ~p / 2) - 1 / 2) * (~a - ~b * ~x) ^ (~p / 2 - 1 / 2), ~x), ~x, sin(~e + ~f * ~x)) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegerQ(~p / 2) && Not(IntegerQ(~m))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => Antiderivative(ExpandTrig((~g * cos(~e + ~f * ~x)) ^ ~p, (~d * sin(~e + ~f * ~x)) ^ ~n * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m, ~x), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IGtQ(~m, 0) && (IntegerQ(~p) || IGtQ(~n, 0))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (((~a) ^ ~m * ~g * (~g * cos(~e + ~f * ~x)) ^ (~p - 1)) / (~f * (1 + sin(~e + ~f * ~x)) ^ ((~p - 1) / 2) * (1 - sin(~e + ~f * ~x)) ^ ((~p - 1) / 2))) * Subst(Antiderivative((~d * ~x) ^ ~n * (1 + (~b / ~a) * ~x) ^ (~m + (~p - 1) / 2) * (1 - (~b / ~a) * ~x) ^ ((~p - 1) / 2), ~x), ~x, sin(~e + ~f * ~x)) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~n, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && IntegerQ(~m))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => ((~g * (~g * cos(~e + ~f * ~x)) ^ (~p - 1)) / (~f * (~a + ~b * sin(~e + ~f * ~x)) ^ ((~p - 1) / 2) * (~a - ~b * sin(~e + ~f * ~x)) ^ ((~p - 1) / 2))) * Subst(Antiderivative((~d * ~x) ^ ~n * (~a + ~b * ~x) ^ (~m + (~p - 1) / 2) * (~a - ~b * ~x) ^ ((~p - 1) / 2), ~x), ~x, sin(~e + ~f * ~x)) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m, ~n, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && Not(IntegerQ(~m)))
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m) / sqrt(~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (-(~g) * (~g * cos(~e + ~f * ~x)) ^ (~p - 1) * sqrt(~d * sin(~e + ~f * ~x)) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / (~a * ~d * ~f * (~m + 1)) + (((~g) ^ 2 * (2 * ~m + 3)) / (2 * ~a * (~m + 1))) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / sqrt(~d * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (LtQ(~m, -1) && EqQ(~m + ~p + 1 / 2, 0)))
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m) / sqrt(~(d') * sin(~(e') + ~(f') * ~x)), ~x) => (2 * (~g * cos(~e + ~f * ~x)) ^ (~p + 1) * sqrt(~d * sin(~e + ~f * ~x)) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m) / (~d * ~f * ~g * (2 * ~m + 1)) + ((2 * ~a * ~m) / ((~g) ^ 2 * (2 * ~m + 1))) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ (~p + 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m - 1)) / sqrt(~d * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (GtQ(~m, 0) && EqQ(~m + ~p + 3 / 2, 0)))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 2 * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => Antiderivative((~d * sin(~e + ~f * ~x)) ^ ~n * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (1 - sin(~e + ~f * ~x) ^ 2), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m, ~n], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IGtQ(~m, 0) || IntegersQ(2 * ~m, 2 * ~n)))
    #= Antiderivative(cos((~e')+(~f')*(~x))^4*sin((~e')+(~f')*(~x))^(~n)*((~a)+(~b')*sin((~e')+(~f')*(~x)))^ (~m),~x) :=  (a^2-b^2)*cos(e+f*x)*sin(e+f*x)^(n+1)*(a+b*sin(e+f*x))^(m+1)/(a*b^2*d* (m+1)) - (a^2*(n+1)-b^2*(m+n+2))*cos(e+f*x)*sin(e+f*x)^(n+1)*(a+b*sin(e+f*x)) ^(m+2)/(a^2*b^2*d*(n+1)*(m+1)) + 1/(a^2*b*(n+1)*(m+1))*Antiderivative(sin(e+f*x)^(n+1)*(a+b*sin(e+f*x))^(m+1)* Simp(a^2*(n+1)*(n+2)-b^2*(m+n+2)*(m+n+3)+a*b*(m+1)*sin(e+f*x)-(a^ 2*(n+1)*(n+3)-b^2*(m+n+2)*(m+n+4))*sin(e+f*x)^2,x),x) <--  FreeQ([a,b,d,e,f],x) && NeQ(a^2-b^2,0) && IntegersQ(2*m,2*n) &&  LtQ(m,-1) && LtQ(n,-1) =#
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 4 * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => ((cos(~e + ~f * ~x) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / (~a * ~d * ~f * (~n + 1)) - (((~a) ^ 2 * (~n + 1) - (~b) ^ 2 * (~m + ~n + 2)) * cos(~e + ~f * ~x) * (~d * sin(~e + ~f * ~x)) ^ (~n + 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / ((~a) ^ 2 * ~b * (~d) ^ 2 * ~f * (~n + 1) * (~m + 1))) + (1 / ((~a) ^ 2 * ~b * ~d * (~n + 1) * (~m + 1))) * Antiderivative((~d * sin(~e + ~f * ~x)) ^ (~n + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * Simp((((~a) ^ 2 * (~n + 1) * (~n + 2) - (~b) ^ 2 * (~m + ~n + 2) * (~m + ~n + 3)) + ~a * ~b * (~m + 1) * sin(~e + ~f * ~x)) - ((~a) ^ 2 * (~n + 1) * (~n + 3) - (~b) ^ 2 * (~m + ~n + 2) * (~m + ~n + 4)) * sin(~e + ~f * ~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(2 * ~m, 2 * ~n) && (LtQ(~m, -1) && LtQ(~n, -1))))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 4 * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => ((((~a) ^ 2 - (~b) ^ 2) * cos(~e + ~f * ~x) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1)) / (~a * (~b) ^ 2 * ~d * ~f * (~m + 1)) + (((~a) ^ 2 * ((~n - ~m) + 1) - (~b) ^ 2 * (~m + ~n + 2)) * cos(~e + ~f * ~x) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 2) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1)) / ((~a) ^ 2 * (~b) ^ 2 * ~d * ~f * (~m + 1) * (~m + 2))) - (1 / ((~a) ^ 2 * (~b) ^ 2 * (~m + 1) * (~m + 2))) * Antiderivative((~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 2) * (~d * sin(~e + ~f * ~x)) ^ ~n * Simp((((~a) ^ 2 * (~n + 1) * (~n + 3) - (~b) ^ 2 * (~m + ~n + 2) * (~m + ~n + 3)) + ~a * ~b * (~m + 2) * sin(~e + ~f * ~x)) - ((~a) ^ 2 * (~n + 2) * (~n + 3) - (~b) ^ 2 * (~m + ~n + 2) * (~m + ~n + 4)) * sin(~e + ~f * ~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~n], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(2 * ~m, 2 * ~n) && (LtQ(~m, -1) && (Not(LtQ(~n, -1)) && (LtQ(~m, -2) || EqQ(~m + ~n + 4, 0))))))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 4 * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => ((((~a) ^ 2 - (~b) ^ 2) * cos(~e + ~f * ~x) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1)) / (~a * (~b) ^ 2 * ~d * ~f * (~m + 1)) - (cos(~e + ~f * ~x) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 2) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1)) / ((~b) ^ 2 * ~d * ~f * (~m + ~n + 4))) - (1 / (~a * (~b) ^ 2 * (~m + 1) * (~m + ~n + 4))) * Antiderivative((~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~d * sin(~e + ~f * ~x)) ^ ~n * Simp((((~a) ^ 2 * (~n + 1) * (~n + 3) - (~b) ^ 2 * (~m + ~n + 2) * (~m + ~n + 4)) + ~a * ~b * (~m + 1) * sin(~e + ~f * ~x)) - ((~a) ^ 2 * (~n + 2) * (~n + 3) - (~b) ^ 2 * (~m + ~n + 3) * (~m + ~n + 4)) * sin(~e + ~f * ~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~n], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(2 * ~m, 2 * ~n) && (LtQ(~m, -1) && (Not(LtQ(~n, -1)) && NeQ(~m + ~n + 4, 0)))))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 4 * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => ((cos(~e + ~f * ~x) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1)) / (~a * ~d * ~f * (~n + 1)) - (~b * (~m + ~n + 2) * cos(~e + ~f * ~x) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~d * sin(~e + ~f * ~x)) ^ (~n + 2)) / ((~a) ^ 2 * (~d) ^ 2 * ~f * (~n + 1) * (~n + 2))) - (1 / ((~a) ^ 2 * (~d) ^ 2 * (~n + 1) * (~n + 2))) * Antiderivative((~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~d * sin(~e + ~f * ~x)) ^ (~n + 2) * Simp((((~a) ^ 2 * ~n * (~n + 2) - (~b) ^ 2 * (~m + ~n + 2) * (~m + ~n + 3)) + ~a * ~b * ~m * sin(~e + ~f * ~x)) - ((~a) ^ 2 * (~n + 1) * (~n + 2) - (~b) ^ 2 * (~m + ~n + 2) * (~m + ~n + 4)) * sin(~e + ~f * ~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && ((IGtQ(~m, 0) || IntegersQ(2 * ~m, 2 * ~n)) && (Not(~m < -1) && (LtQ(~n, -1) && (LtQ(~n, -2) || EqQ(~m + ~n + 4, 0))))))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 4 * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => ((cos(~e + ~f * ~x) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1)) / (~a * ~d * ~f * (~n + 1)) - (cos(~e + ~f * ~x) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~d * sin(~e + ~f * ~x)) ^ (~n + 2)) / (~b * (~d) ^ 2 * ~f * (~m + ~n + 4))) + (1 / (~a * ~b * ~d * (~n + 1) * (~m + ~n + 4))) * Antiderivative((~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~d * sin(~e + ~f * ~x)) ^ (~n + 1) * Simp((((~a) ^ 2 * (~n + 1) * (~n + 2) - (~b) ^ 2 * (~m + ~n + 2) * (~m + ~n + 4)) + ~a * ~b * (~m + 3) * sin(~e + ~f * ~x)) - ((~a) ^ 2 * (~n + 1) * (~n + 3) - (~b) ^ 2 * (~m + ~n + 3) * (~m + ~n + 4)) * sin(~e + ~f * ~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && ((IGtQ(~m, 0) || IntegersQ(2 * ~m, 2 * ~n)) && (Not(~m < -1) && (LtQ(~n, -1) && NeQ(~m + ~n + 4, 0)))))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 4 * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => ((~a * (~n + 3) * cos(~e + ~f * ~x) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / ((~b) ^ 2 * ~d * ~f * (~m + ~n + 3) * (~m + ~n + 4)) - (cos(~e + ~f * ~x) * (~d * sin(~e + ~f * ~x)) ^ (~n + 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / (~b * (~d) ^ 2 * ~f * (~m + ~n + 4))) - (1 / ((~b) ^ 2 * (~m + ~n + 3) * (~m + ~n + 4))) * Antiderivative((~d * sin(~e + ~f * ~x)) ^ ~n * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * Simp((((~a) ^ 2 * (~n + 1) * (~n + 3) - (~b) ^ 2 * (~m + ~n + 3) * (~m + ~n + 4)) + ~a * ~b * ~m * sin(~e + ~f * ~x)) - ((~a) ^ 2 * (~n + 2) * (~n + 3) - (~b) ^ 2 * (~m + ~n + 3) * (~m + ~n + 5)) * sin(~e + ~f * ~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m, ~n], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && ((IGtQ(~m, 0) || IntegersQ(2 * ~m, 2 * ~n)) && (Not(~m < -1) && (Not(LtQ(~n, -1)) && (NeQ(~m + ~n + 3, 0) && NeQ(~m + ~n + 4, 0))))))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 6 * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (((cos(~e + ~f * ~x) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / (~a * ~d * ~f * (~n + 1)) - (~b * (~m + ~n + 2) * cos(~e + ~f * ~x) * (~d * sin(~e + ~f * ~x)) ^ (~n + 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / ((~a) ^ 2 * (~d) ^ 2 * ~f * (~n + 1) * (~n + 2))) - (~a * (~n + 5) * cos(~e + ~f * ~x) * (~d * sin(~e + ~f * ~x)) ^ (~n + 3) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / ((~b) ^ 2 * (~d) ^ 3 * ~f * (~m + ~n + 5) * (~m + ~n + 6))) + (cos(~e + ~f * ~x) * (~d * sin(~e + ~f * ~x)) ^ (~n + 4) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1)) / (~b * (~d) ^ 4 * ~f * (~m + ~n + 6)) + (1 / ((~a) ^ 2 * (~b) ^ 2 * (~d) ^ 2 * (~n + 1) * (~n + 2) * (~m + ~n + 5) * (~m + ~n + 6))) * Antiderivative((~d * sin(~e + ~f * ~x)) ^ (~n + 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * Simp((((~a) ^ 4 * (~n + 1) * (~n + 2) * (~n + 3) * (~n + 5) - (~a) ^ 2 * (~b) ^ 2 * (~n + 2) * (2 * ~n + 1) * (~m + ~n + 5) * (~m + ~n + 6)) + (~b) ^ 4 * (~m + ~n + 2) * (~m + ~n + 3) * (~m + ~n + 5) * (~m + ~n + 6) + ~a * ~b * ~m * ((~a) ^ 2 * (~n + 1) * (~n + 2) - (~b) ^ 2 * (~m + ~n + 5) * (~m + ~n + 6)) * sin(~e + ~f * ~x)) - (((~a) ^ 4 * (~n + 1) * (~n + 2) * (4 + ~n) * (~n + 5) + (~b) ^ 4 * (~m + ~n + 2) * (~m + ~n + 4) * (~m + ~n + 5) * (~m + ~n + 6)) - (~a) ^ 2 * (~b) ^ 2 * (~n + 1) * (~n + 2) * (~m + ~n + 5) * (2 * ~n + 2 * ~m + 13)) * sin(~e + ~f * ~x) ^ 2, ~x), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~m, ~n], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(2 * ~m, 2 * ~n) && (NeQ(~n, -1) && (NeQ(~n, -2) && (NeQ(~m + ~n + 5, 0) && (NeQ(~m + ~n + 6, 0) && Not(IGtQ(~m, 0))))))))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => Antiderivative(ExpandTrig((~d * sin(~e + ~f * ~x)) ^ ~n * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (1 - sin(~e + ~f * ~x) ^ 2) ^ (~p / 2), ~x), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(~m, 2 * ~n, ~p / 2) && (LtQ(~m, -1) || EqQ(~m, -1) && GtQ(~p, 0))))
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * sin(~(e') + ~(f') * ~x) ^ ~n) / (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => Antiderivative(ExpandTrig((~g * cos(~e + ~f * ~x)) ^ ~p, sin(~e + ~f * ~x) ^ ~n / (~a + ~b * sin(~e + ~f * ~x)), ~x), ~x) <-- FreeQ([~a, ~b, ~e, ~f, ~g, ~p], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegerQ(~n) && (LtQ(~n, 0) || IGtQ(~p + 1 / 2, 0))))
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n) / (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => (((~g) ^ 2 / ~a) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ ~n, ~x) - ((~b * (~g) ^ 2) / ((~a) ^ 2 * ~d)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1), ~x)) - (((~g) ^ 2 * ((~a) ^ 2 - (~b) ^ 2)) / ((~a) ^ 2 * (~d) ^ 2)) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ (~n + 2)) / (~a + ~b * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(2 * ~n, 2 * ~p) && (GtQ(~p, 1) && (LeQ(~n, -2) || EqQ(~n, -3 / 2) && EqQ(~p, 3 / 2)))))
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n) / (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => ((~g) ^ 2 / (~a * ~b)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ ~n * (~b - ~a * sin(~e + ~f * ~x)), ~x) + (((~g) ^ 2 * ((~a) ^ 2 - (~b) ^ 2)) / (~a * ~b * ~d)) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1)) / (~a + ~b * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(2 * ~n, 2 * ~p) && (GtQ(~p, 1) && (LtQ(~n, -1) || EqQ(~p, 3 / 2) && EqQ(~n, -1 / 2)))))
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n) / (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => ((~g) ^ 2 / (~b) ^ 2) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ ~n * (~a - ~b * sin(~e + ~f * ~x)), ~x) - (((~g) ^ 2 * ((~a) ^ 2 - (~b) ^ 2)) / (~b) ^ 2) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ ~n) / (~a + ~b * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(2 * ~n, 2 * ~p) && GtQ(~p, 1)))
    #= Antiderivative(((~g')*cos((~e')+(~f')*(~x)))^(~p)*((~d')*sin((~e')+(~f')*(~x)))^(~n)/((~a)+(~b')*sin( (~e')+(~f')*(~x))),~x) :=  g^2*Antiderivative((g*cos(e+f*x))^(p-2)*(d*sin(e+f*x))^n/(a+b*sin(e+f*x)),x) - g^2/d^2*Antiderivative((g*cos(e+f*x))^(p-2)*(d*sin(e+f*x))^(n+2)/(a+b*sin(e+f* x)),x) <-- FreeQ([a,b,d,e,f,g],x) && NeQ(a^2-b^2,0) &&  IntegersQ(2*n,2*p) && GtQ(p,1) =#
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n) / (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => (((~a * (~d) ^ 2) / ((~a) ^ 2 - (~b) ^ 2)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ (~n - 2), ~x) - ((~b * ~d) / ((~a) ^ 2 - (~b) ^ 2)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ (~n - 1), ~x)) - (((~a) ^ 2 * (~d) ^ 2) / ((~g) ^ 2 * ((~a) ^ 2 - (~b) ^ 2))) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ (~p + 2) * (~d * sin(~e + ~f * ~x)) ^ (~n - 2)) / (~a + ~b * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(2 * ~n, 2 * ~p) && (LtQ(~p, -1) && GtQ(~n, 1))))
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n) / (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => (-(~d) / ((~a) ^ 2 - (~b) ^ 2)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ (~n - 1) * (~b - ~a * sin(~e + ~f * ~x)), ~x) + ((~a * ~b * ~d) / ((~g) ^ 2 * ((~a) ^ 2 - (~b) ^ 2))) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ (~p + 2) * (~d * sin(~e + ~f * ~x)) ^ (~n - 1)) / (~a + ~b * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(2 * ~n, 2 * ~p) && (LtQ(~p, -1) && GtQ(~n, 0))))
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n) / (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => (1 / ((~a) ^ 2 - (~b) ^ 2)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ ~n * (~a - ~b * sin(~e + ~f * ~x)), ~x) - ((~b) ^ 2 / ((~g) ^ 2 * ((~a) ^ 2 - (~b) ^ 2))) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ (~p + 2) * (~d * sin(~e + ~f * ~x)) ^ ~n) / (~a + ~b * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(2 * ~n, 2 * ~p) && LtQ(~p, -1)))
    @apply_utils Antiderivative(sqrt(~(g') * cos(~(e') + ~(f') * ~x)) / (sqrt(sin(~(e') + ~(f') * ~x)) * (~a + ~(b') * sin(~(e') + ~(f') * ~x))), ~x) => ((-4 * sqrt(2) * ~g) / ~f) * Subst(Antiderivative((~x) ^ 2 / (((~a + ~b) * (~g) ^ 2 + (~a - ~b) * (~x) ^ 4) * sqrt(1 - (~x) ^ 4 / (~g) ^ 2)), ~x), ~x, sqrt(~g * cos(~e + ~f * ~x)) / sqrt(1 + sin(~e + ~f * ~x))) <-- FreeQ([~a, ~b, ~e, ~f, ~g], ~x) && NeQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative(sqrt(~(g') * cos(~(e') + ~(f') * ~x)) / (sqrt(~d * sin(~(e') + ~(f') * ~x)) * (~a + ~(b') * sin(~(e') + ~(f') * ~x))), ~x) => (sqrt(sin(~e + ~f * ~x)) / sqrt(~d * sin(~e + ~f * ~x))) * Antiderivative(sqrt(~g * cos(~e + ~f * ~x)) / (sqrt(sin(~e + ~f * ~x)) * (~a + ~b * sin(~e + ~f * ~x))), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g], ~x) && NeQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative(sqrt(~(d') * sin(~(e') + ~(f') * ~x)) / (sqrt(cos(~(e') + ~(f') * ~x)) * (~a + ~(b') * sin(~(e') + ~(f') * ~x))), ~x) => With([q = Rt(-((~a) ^ 2) + (~b) ^ 2, 2)], ((2 * sqrt(2) * ~d * (~b + q)) / (~f * q)) * Subst(Antiderivative(1 / ((~d * (~b + q) + ~a * (~x) ^ 2) * sqrt(1 - (~x) ^ 4 / (~d) ^ 2)), ~x), ~x, sqrt(~d * sin(~e + ~f * ~x)) / sqrt(1 + cos(~e + ~f * ~x))) - ((2 * sqrt(2) * ~d * (~b - q)) / (~f * q)) * Subst(Antiderivative(1 / ((~d * (~b - q) + ~a * (~x) ^ 2) * sqrt(1 - (~x) ^ 4 / (~d) ^ 2)), ~x), ~x, sqrt(~d * sin(~e + ~f * ~x)) / sqrt(1 + cos(~e + ~f * ~x)))) <-- FreeQ([~a, ~b, ~d, ~e, ~f], ~x) && NeQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative(sqrt(~(d') * sin(~(e') + ~(f') * ~x)) / (sqrt(~(g') * cos(~(e') + ~(f') * ~x)) * (~a + ~(b') * sin(~(e') + ~(f') * ~x))), ~x) => (sqrt(cos(~e + ~f * ~x)) / sqrt(~g * cos(~e + ~f * ~x))) * Antiderivative(sqrt(~d * sin(~e + ~f * ~x)) / (sqrt(cos(~e + ~f * ~x)) * (~a + ~b * sin(~e + ~f * ~x))), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g], ~x) && NeQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n) / (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => (~d / ~b) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ (~n - 1), ~x) - ((~a * ~d) / ~b) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ (~n - 1)) / (~a + ~b * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(2 * ~n, 2 * ~p) && (LtQ(-1, ~p, 1) && GtQ(~n, 0))))
    @apply_utils Antiderivative(((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n) / (~a + ~(b') * sin(~(e') + ~(f') * ~x)), ~x) => (1 / ~a) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ ~n, ~x) - (~b / (~a * ~d)) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ (~n + 1)) / (~a + ~b * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(2 * ~n, 2 * ~p) && (LtQ(-1, ~p, 1) && LtQ(~n, 0))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ 2, ~x) => ((2 * ~a * ~b) / ~d) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ (~n + 1), ~x) + Antiderivative((~g * cos(~e + ~f * ~x)) ^ ~p * (~d * sin(~e + ~f * ~x)) ^ ~n * ((~a) ^ 2 + (~b) ^ 2 * sin(~e + ~f * ~x) ^ 2), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && NeQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => Antiderivative(ExpandTrig((~g * cos(~e + ~f * ~x)) ^ ~p, (~d * sin(~e + ~f * ~x)) ^ ~n * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m, ~x), ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegerQ(~m) && (GtQ(~m, 0) || IntegerQ(~n))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m, ~x) => (((~g) ^ 2 / ~a) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ ~n * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1), ~x) - ((~b * (~g) ^ 2) / ((~a) ^ 2 * ~d)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ (~n + 1) * (~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1), ~x)) - (((~g) ^ 2 * ((~a) ^ 2 - (~b) ^ 2)) / ((~a) ^ 2 * (~d) ^ 2)) * Antiderivative((~g * cos(~e + ~f * ~x)) ^ (~p - 2) * (~d * sin(~e + ~f * ~x)) ^ (~n + 2) * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m, ~x) <-- FreeQ([~a, ~b, ~d, ~e, ~f, ~g], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(~m, 2 * ~n, 2 * ~p) && (LtQ(~m, 0) && (GtQ(~p, 1) && (LeQ(~n, -2) || EqQ(~m, -1) && (EqQ(~n, -3 / 2) && EqQ(~p, 3 / 2)))))))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~a) ^ (2 * ~m) * Antiderivative((~c + ~d * sin(~e + ~f * ~x)) ^ ~n / (~a - ~b * sin(~e + ~f * ~x)) ^ ~m, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegersQ(~m, ~p) && EqQ(2 * ~m + ~p, 0)))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (~a / ~g) ^ (2 * ~m) * Antiderivative(((~g * cos(~e + ~f * ~x)) ^ (2 * ~m + ~p) * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n) / (~a - ~b * sin(~e + ~f * ~x)) ^ ~m, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegerQ(~m) && (EqQ(2 * ~m + ~p, 0) || GtQ(2 * ~m + ~p, 0) && LtQ(~p, -1))))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 2 * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (1 / (~b) ^ 2) * Antiderivative((~a + ~b * sin(~e + ~f * ~x)) ^ (~m + 1) * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n * (~a - ~b * sin(~e + ~f * ~x)), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && IntegersQ(2 * ~m, 2 * ~n))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (((~a) ^ ~m * cos(~e + ~f * ~x)) / (~f * sqrt(1 + sin(~e + ~f * ~x)) * sqrt(1 - sin(~e + ~f * ~x)))) * Subst(Antiderivative((1 + (~b / ~a) * ~x) ^ (~m + (~p - 1) / 2) * (1 - (~b / ~a) * ~x) ^ ((~p - 1) / 2) * (~c + ~d * ~x) ^ ~n, ~x), ~x, sin(~e + ~f * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegerQ(~p / 2) && IntegerQ(~m)))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (cos(~e + ~f * ~x) / ((~a) ^ (~p - 2) * ~f * sqrt(~a + ~b * sin(~e + ~f * ~x)) * sqrt(~a - ~b * sin(~e + ~f * ~x)))) * Subst(Antiderivative((~a + ~b * ~x) ^ ((~m + ~p / 2) - 1 / 2) * (~a - ~b * ~x) ^ (~p / 2 - 1 / 2) * (~c + ~d * ~x) ^ ~n, ~x), ~x, sin(~e + ~f * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IntegerQ(~p / 2) && Not(IntegerQ(~m))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => Antiderivative(ExpandTrig((~g * cos(~e + ~f * ~x)) ^ ~p, (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~n, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && (IGtQ(~m, 0) && (IntegerQ(~p) || IGtQ(~n, 0))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => (((~a) ^ ~m * ~g * (~g * cos(~e + ~f * ~x)) ^ (~p - 1)) / (~f * (1 + sin(~e + ~f * ~x)) ^ ((~p - 1) / 2) * (1 - sin(~e + ~f * ~x)) ^ ((~p - 1) / 2))) * Subst(Antiderivative((1 + (~b / ~a) * ~x) ^ (~m + (~p - 1) / 2) * (1 - (~b / ~a) * ~x) ^ ((~p - 1) / 2) * (~c + ~d * ~x) ^ ~n, ~x), ~x, sin(~e + ~f * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~n, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && IntegerQ(~m))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => ((~g * (~g * cos(~e + ~f * ~x)) ^ (~p - 1)) / (~f * (~a + ~b * sin(~e + ~f * ~x)) ^ ((~p - 1) / 2) * (~a - ~b * sin(~e + ~f * ~x)) ^ ((~p - 1) / 2))) * Subst(Antiderivative((~a + ~b * ~x) ^ (~m + (~p - 1) / 2) * (~a - ~b * ~x) ^ ((~p - 1) / 2) * (~c + ~d * ~x) ^ ~n, ~x), ~x, sin(~e + ~f * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p], ~x) && (EqQ((~a) ^ 2 - (~b) ^ 2, 0) && Not(IntegerQ(~m)))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ 2 * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => Antiderivative((~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n * (1 - sin(~e + ~f * ~x) ^ 2), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IGtQ(~m, 0) || IntegersQ(2 * ~m, 2 * ~n)))
    @apply_utils Antiderivative(cos(~(e') + ~(f') * ~x) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => Antiderivative(ExpandTrig((~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n * (1 - sin(~e + ~f * ~x) ^ 2) ^ (~p / 2), ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && (IGtQ(~p / 2, 0) && (IGtQ(~m, 0) || IntegersQ(2 * ~m, 2 * ~n))))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~m * (~c + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~n, ~x) => Antiderivative(ExpandTrig((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~p], ~x) && (NeQ((~a) ^ 2 - (~b) ^ 2, 0) && IntegersQ(2 * ~m, 2 * ~n))
    @apply_utils Antiderivative((~(g') * cos(~(e') + ~(f') * ~x)) ^ ~p * (~a + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => Unintegrable((~g * cos(~e + ~f * ~x)) ^ ~p * (~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && NeQ((~a) ^ 2 - (~b) ^ 2, 0)
    @apply_utils Antiderivative((~(g') * sec(~(e') + ~(f') * ~x)) ^ ~p * (~(a') + ~(b') * sin(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * sin(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => (~g) ^ (2 * IntPart(~p)) * (~g * cos(~e + ~f * ~x)) ^ FracPart(~p) * (~g * sec(~e + ~f * ~x)) ^ FracPart(~p) * Antiderivative(((~a + ~b * sin(~e + ~f * ~x)) ^ ~m * (~c + ~d * sin(~e + ~f * ~x)) ^ ~n) / (~g * cos(~e + ~f * ~x)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && Not(IntegerQ(~p))
    @apply_utils Antiderivative((~(g') * csc(~(e') + ~(f') * ~x)) ^ ~p * (~(a') + ~(b') * cos(~(e') + ~(f') * ~x)) ^ ~(m') * (~(c') + ~(d') * cos(~(e') + ~(f') * ~x)) ^ ~(n'), ~x) => (~g) ^ (2 * IntPart(~p)) * (~g * sin(~e + ~f * ~x)) ^ FracPart(~p) * (~g * csc(~e + ~f * ~x)) ^ FracPart(~p) * Antiderivative(((~a + ~b * cos(~e + ~f * ~x)) ^ ~m * (~c + ~d * cos(~e + ~f * ~x)) ^ ~n) / (~g * sin(~e + ~f * ~x)) ^ ~p, ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~g, ~m, ~n, ~p], ~x) && Not(IntegerQ(~p))
end
