int_rules_4_3_9 = @theory begin

    #= ::Subsection::Closed:: =#
    #= 4.3.9*trig^m*(a+b*tan^n+c*tan^(2*n))^p =#
    @apply_utils Antiderivative((~a + ~(b') * tan(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * tan(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~(p'), ~x) => (1 / (4 ^ ~p * (~c) ^ ~p)) * Antiderivative((~b + 2 * ~c * tan(~d + ~e * ~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IntegerQ(~p)))
    @apply_utils Antiderivative((~a + ~(b') * cot(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * cot(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~(p'), ~x) => (1 / (4 ^ ~p * (~c) ^ ~p)) * Antiderivative((~b + 2 * ~c * cot(~d + ~e * ~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IntegerQ(~p)))
    @apply_utils Antiderivative((~a + ~(b') * tan(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * tan(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~p, ~x) => ((~a + ~b * tan(~d + ~e * ~x) ^ ~n + ~c * tan(~d + ~e * ~x) ^ (2 * ~n)) ^ ~p / (~b + 2 * ~c * tan(~d + ~e * ~x) ^ ~n) ^ (2 * ~p)) * Antiderivative((~b + 2 * ~c * tan(~d + ~e * ~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && Not(IntegerQ(~p))))
    @apply_utils Antiderivative((~a + ~(b') * cot(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * cot(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~p, ~x) => ((~a + ~b * cot(~d + ~e * ~x) ^ ~n + ~c * cot(~d + ~e * ~x) ^ (2 * ~n)) ^ ~p / (~b + 2 * ~c * cot(~d + ~e * ~x) ^ ~n) ^ (2 * ~p)) * Antiderivative((~b + 2 * ~c * cot(~d + ~e * ~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && Not(IntegerQ(~p))))
    @apply_utils Antiderivative(1 / (~(a') + ~(b') * tan(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * tan(~(d') + ~(e') * ~x) ^ ~(n2')), ~x) => Module([q = Rt((~b) ^ 2 - 4 * ~a * ~c, 2)], ((2 * ~c) / q) * Antiderivative(1 / ((~b - q) + 2 * ~c * tan(~d + ~e * ~x) ^ ~n), ~x) - ((2 * ~c) / q) * Antiderivative(1 / (~b + q + 2 * ~c * tan(~d + ~e * ~x) ^ ~n), ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~n], ~x) && (EqQ(~n2, 2 * ~n) && NeQ((~b) ^ 2 - 4 * ~a * ~c, 0))
    @apply_utils Antiderivative(1 / (~(a') + ~(b') * cot(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * cot(~(d') + ~(e') * ~x) ^ ~(n2')), ~x) => Module([q = Rt((~b) ^ 2 - 4 * ~a * ~c, 2)], ((2 * ~c) / q) * Antiderivative(1 / ((~b - q) + 2 * ~c * cot(~d + ~e * ~x) ^ ~n), ~x) - ((2 * ~c) / q) * Antiderivative(1 / (~b + q + 2 * ~c * cot(~d + ~e * ~x) ^ ~n), ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~n], ~x) && (EqQ(~n2, 2 * ~n) && NeQ((~b) ^ 2 - 4 * ~a * ~c, 0))
    @apply_utils Antiderivative(sin(~(d') + ~(e') * ~x) ^ ~m * (~(a') + ~(b') * (~(f') * tan(~(d') + ~(e') * ~x)) ^ ~(n') + ~(c') * (~(f') * tan(~(d') + ~(e') * ~x)) ^ ~(n2')) ^ ~p, ~x) => (~f / ~e) * Subst(Antiderivative(((~x) ^ ~m * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p) / ((~f) ^ 2 + (~x) ^ 2) ^ (~m / 2 + 1), ~x), ~x, ~f * tan(~d + ~e * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && IntegerQ(~m / 2))
    @apply_utils Antiderivative(cos(~(d') + ~(e') * ~x) ^ ~m * (~(a') + ~(b') * (~(f') * cot(~(d') + ~(e') * ~x)) ^ ~(n') + ~(c') * (~(f') * cot(~(d') + ~(e') * ~x)) ^ ~(n2')) ^ ~p, ~x) => (-(~f) / ~e) * Subst(Antiderivative(((~x) ^ ~m * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p) / ((~f) ^ 2 + (~x) ^ 2) ^ (~m / 2 + 1), ~x), ~x, ~f * cot(~d + ~e * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && IntegerQ(~m / 2))
    @apply_utils Antiderivative(sin(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * tan(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * tan(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~(p'), ~x) => Module([g = FreeFactors(cos(~d + ~e * ~x), ~x)], (-g / ~e) * Subst(Antiderivative(((1 - g ^ 2 * (~x) ^ 2) ^ ((~m - 1) / 2) * ExpandToSum(~a * (g * ~x) ^ (2 * ~n) + ~b * (g * ~x) ^ ~n * (1 - g ^ 2 * (~x) ^ 2) ^ (~n / 2) + ~c * (1 - g ^ 2 * (~x) ^ 2) ^ ~n, ~x) ^ ~p) / (g * ~x) ^ (2 * ~n * ~p), ~x), ~x, cos(~d + ~e * ~x) / g)) <-- FreeQ([~a, ~b, ~c, ~d, ~e], ~x) && (EqQ(~n2, 2 * ~n) && (IntegerQ((~m - 1) / 2) && (IntegerQ(~n / 2) && IntegerQ(~p))))
    @apply_utils Antiderivative(cos(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * cot(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * tan(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~(p'), ~x) => Module([g = FreeFactors(sin(~d + ~e * ~x), ~x)], (g / ~e) * Subst(Antiderivative(((1 - g ^ 2 * (~x) ^ 2) ^ ((~m - 1) / 2) * ExpandToSum(~a * (g * ~x) ^ (2 * ~n) + ~b * (g * ~x) ^ ~n * (1 - g ^ 2 * (~x) ^ 2) ^ (~n / 2) + ~c * (1 - g ^ 2 * (~x) ^ 2) ^ ~n, ~x) ^ ~p) / (g * ~x) ^ (2 * ~n * ~p), ~x), ~x, sin(~d + ~e * ~x) / g)) <-- FreeQ([~a, ~b, ~c, ~d, ~e], ~x) && (EqQ(~n2, 2 * ~n) && (IntegerQ((~m - 1) / 2) && (IntegerQ(~n / 2) && IntegerQ(~p))))
    @apply_utils Antiderivative(cos(~(d') + ~(e') * ~x) ^ ~m * (~(a') + ~(b') * (~(f') * tan(~(d') + ~(e') * ~x)) ^ ~(n') + ~(c') * (~(f') * tan(~(d') + ~(e') * ~x)) ^ ~(n2')) ^ ~(p'), ~x) => ((~f) ^ (~m + 1) / ~e) * Subst(Antiderivative((~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p / ((~f) ^ 2 + (~x) ^ 2) ^ (~m / 2 + 1), ~x), ~x, ~f * tan(~d + ~e * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && IntegerQ(~m / 2))
    @apply_utils Antiderivative(sin(~(d') + ~(e') * ~x) ^ ~m * (~(a') + ~(b') * (~(f') * cot(~(d') + ~(e') * ~x)) ^ ~(n') + ~(c') * (~(f') * cot(~(d') + ~(e') * ~x)) ^ ~(n2')) ^ ~(p'), ~x) => (-((~f) ^ (~m + 1)) / ~e) * Subst(Antiderivative((~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p / ((~f) ^ 2 + (~x) ^ 2) ^ (~m / 2 + 1), ~x), ~x, ~f * cot(~d + ~e * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && IntegerQ(~m / 2))
    @apply_utils Antiderivative(cos(~(d') + ~(e') * ~x) ^ ~m * (~(a') + ~(b') * tan(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * tan(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~(p'), ~x) => Module([g = FreeFactors(sin(~d + ~e * ~x), ~x)], (g / ~e) * Subst(Antiderivative((1 - g ^ 2 * (~x) ^ 2) ^ (((~m - 2 * ~n * ~p) - 1) / 2) * ExpandToSum(~c * (~x) ^ (2 * ~n) + ~b * (~x) ^ ~n * (1 - (~x) ^ 2) ^ (~n / 2) + ~a * (1 - (~x) ^ 2) ^ ~n, ~x) ^ ~p, ~x), ~x, sin(~d + ~e * ~x) / g)) <-- FreeQ([~a, ~b, ~c, ~d, ~e], ~x) && (EqQ(~n2, 2 * ~n) && (IntegerQ((~m - 1) / 2) && (IntegerQ(~n / 2) && IntegerQ(~p))))
    @apply_utils Antiderivative(sin(~(d') + ~(e') * ~x) ^ ~m * (~(a') + ~(b') * cot(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * cot(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~(p'), ~x) => Module([g = FreeFactors(cos(~d + ~e * ~x), ~x)], (-g / ~e) * Subst(Antiderivative((1 - g ^ 2 * (~x) ^ 2) ^ (((~m - 2 * ~n * ~p) - 1) / 2) * ExpandToSum(~c * (~x) ^ (2 * ~n) + ~b * (~x) ^ ~n * (1 - (~x) ^ 2) ^ (~n / 2) + ~a * (1 - (~x) ^ 2) ^ ~n, ~x) ^ ~p, ~x), ~x, cos(~d + ~e * ~x) / g)) <-- FreeQ([~a, ~b, ~c, ~d, ~e], ~x) && (EqQ(~n2, 2 * ~n) && (IntegerQ((~m - 1) / 2) && (IntegerQ(~n / 2) && IntegerQ(~p))))
    @apply_utils Antiderivative(tan(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * tan(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * tan(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~p, ~x) => (1 / (4 ^ ~p * (~c) ^ ~p)) * Antiderivative(tan(~d + ~e * ~x) ^ ~m * (~b + 2 * ~c * tan(~d + ~e * ~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IntegerQ(~p)))
    @apply_utils Antiderivative(cot(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * cot(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * cot(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~p, ~x) => (1 / (4 ^ ~p * (~c) ^ ~p)) * Antiderivative(cot(~d + ~e * ~x) ^ ~m * (~b + 2 * ~c * cot(~d + ~e * ~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IntegerQ(~p)))
    @apply_utils Antiderivative(tan(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * tan(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * tan(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~p, ~x) => ((~a + ~b * tan(~d + ~e * ~x) ^ ~n + ~c * tan(~d + ~e * ~x) ^ (2 * ~n)) ^ ~p / (~b + 2 * ~c * tan(~d + ~e * ~x) ^ ~n) ^ (2 * ~p)) * Antiderivative(tan(~d + ~e * ~x) ^ ~m * (~b + 2 * ~c * tan(~d + ~e * ~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && Not(IntegerQ(~p))))
    @apply_utils Antiderivative(cot(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * cot(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * cot(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~p, ~x) => ((~a + ~b * cot(~d + ~e * ~x) ^ ~n + ~c * cot(~d + ~e * ~x) ^ (2 * ~n)) ^ ~p / (~b + 2 * ~c * cot(~d + ~e * ~x) ^ ~n) ^ (2 * ~p)) * Antiderivative(cot(~d + ~e * ~x) ^ ~m * (~b + 2 * ~c * cot(~d + ~e * ~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && Not(IntegerQ(~p))))
    @apply_utils Antiderivative(tan(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * (~(f') * tan(~(d') + ~(e') * ~x)) ^ ~(n') + ~(c') * (~(f') * tan(~(d') + ~(e') * ~x)) ^ ~(n2')) ^ ~p, ~x) => (~f / ~e) * Subst(Antiderivative(((~x / ~f) ^ ~m * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p) / ((~f) ^ 2 + (~x) ^ 2), ~x), ~x, ~f * tan(~d + ~e * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && NeQ((~b) ^ 2 - 4 * ~a * ~c, 0))
    @apply_utils Antiderivative(cot(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * (~(f') * cot(~(d') + ~(e') * ~x)) ^ ~(n') + ~(c') * (~(f') * cot(~(d') + ~(e') * ~x)) ^ ~(n2')) ^ ~p, ~x) => (-(~f) / ~e) * Subst(Antiderivative(((~x / ~f) ^ ~m * (~a + ~b * (~x) ^ ~n + ~c * (~x) ^ (2 * ~n)) ^ ~p) / ((~f) ^ 2 + (~x) ^ 2), ~x), ~x, ~f * cot(~d + ~e * ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~f, ~m, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && NeQ((~b) ^ 2 - 4 * ~a * ~c, 0))
    @apply_utils Antiderivative(cot(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * tan(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * tan(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~(p'), ~x) => (1 / (4 ^ ~p * (~c) ^ ~p)) * Antiderivative(cot(~d + ~e * ~x) ^ ~m * (~b + 2 * ~c * tan(~d + ~e * ~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IntegerQ(~p)))
    @apply_utils Antiderivative(tan(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * cot(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * cot(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~(p'), ~x) => (1 / (4 ^ ~p * (~c) ^ ~p)) * Antiderivative(tan(~d + ~e * ~x) ^ ~m * (~b + 2 * ~c * cot(~d + ~e * ~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IntegerQ(~p)))
    @apply_utils Antiderivative(cot(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * tan(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * tan(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~p, ~x) => ((~a + ~b * tan(~d + ~e * ~x) ^ ~n + ~c * tan(~d + ~e * ~x) ^ (2 * ~n)) ^ ~p / (~b + 2 * ~c * tan(~d + ~e * ~x) ^ ~n) ^ (2 * ~p)) * Antiderivative(cot(~d + ~e * ~x) ^ ~m * (~b + 2 * ~c * tan(~d + ~e * ~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && Not(IntegerQ(~p))))
    @apply_utils Antiderivative(tan(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * cot(~(d') + ~(e') * ~x) ^ ~(n') + ~(c') * cot(~(d') + ~(e') * ~x) ^ ~(n2')) ^ ~p, ~x) => ((~a + ~b * cot(~d + ~e * ~x) ^ ~n + ~c * cot(~d + ~e * ~x) ^ (2 * ~n)) ^ ~p / (~b + 2 * ~c * cot(~d + ~e * ~x) ^ ~n) ^ (2 * ~p)) * Antiderivative(tan(~d + ~e * ~x) ^ ~m * (~b + 2 * ~c * cot(~d + ~e * ~x) ^ ~n) ^ (2 * ~p), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~n, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && Not(IntegerQ(~p))))
    @apply_utils Antiderivative(cot(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * tan(~(d') + ~(e') * ~x) ^ ~n + ~(c') * tan(~(d') + ~(e') * ~x) ^ ~n2) ^ ~(p'), ~x) => Module([g = FreeFactors(cot(~d + ~e * ~x), ~x)], (g / ~e) * Subst(Antiderivative(((g * ~x) ^ (~m - 2 * ~n * ~p) * (~c + ~b * (g * ~x) ^ ~n + ~a * (g * ~x) ^ (2 * ~n)) ^ ~p) / (1 + g ^ 2 * (~x) ^ 2), ~x), ~x, cot(~d + ~e * ~x) / g)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IntegerQ(~n / 2)))
    @apply_utils Antiderivative(tan(~(d') + ~(e') * ~x) ^ ~(m') * (~(a') + ~(b') * cot(~(d') + ~(e') * ~x) ^ ~n + ~(c') * cot(~(d') + ~(e') * ~x) ^ ~n2) ^ ~(p'), ~x) => Module([g = FreeFactors(tan(~d + ~e * ~x), ~x)], (-g / ~e) * Subst(Antiderivative(((g * ~x) ^ (~m - 2 * ~n * ~p) * (~c + ~b * (g * ~x) ^ ~n + ~a * (g * ~x) ^ (2 * ~n)) ^ ~p) / (1 + g ^ 2 * (~x) ^ 2), ~x), ~x, tan(~d + ~e * ~x) / g)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~m, ~p], ~x) && (EqQ(~n2, 2 * ~n) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IntegerQ(~n / 2)))
    @apply_utils Antiderivative((~A + ~(B') * tan(~(d') + ~(e') * ~x)) * (~a + ~(b') * tan(~(d') + ~(e') * ~x) + ~(c') * tan(~(d') + ~(e') * ~x) ^ 2) ^ ~n, ~x) => (1 / (4 ^ ~n * (~c) ^ ~n)) * Antiderivative((~A + ~B * tan(~d + ~e * ~x)) * (~b + 2 * ~c * tan(~d + ~e * ~x)) ^ (2 * ~n), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~A, ~B], ~x) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IntegerQ(~n))
    @apply_utils Antiderivative((~A + ~(B') * cot(~(d') + ~(e') * ~x)) * (~a + ~(b') * cot(~(d') + ~(e') * ~x) + ~(c') * cot(~(d') + ~(e') * ~x) ^ 2) ^ ~n, ~x) => (1 / (4 ^ ~n * (~c) ^ ~n)) * Antiderivative((~A + ~B * cot(~d + ~e * ~x)) * (~b + 2 * ~c * cot(~d + ~e * ~x)) ^ (2 * ~n), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~A, ~B], ~x) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IntegerQ(~n))
    @apply_utils Antiderivative((~A + ~(B') * tan(~(d') + ~(e') * ~x)) * (~a + ~(b') * tan(~(d') + ~(e') * ~x) + ~(c') * tan(~(d') + ~(e') * ~x) ^ 2) ^ ~n, ~x) => ((~a + ~b * tan(~d + ~e * ~x) + ~c * tan(~d + ~e * ~x) ^ 2) ^ ~n / (~b + 2 * ~c * tan(~d + ~e * ~x)) ^ (2 * ~n)) * Antiderivative((~A + ~B * tan(~d + ~e * ~x)) * (~b + 2 * ~c * tan(~d + ~e * ~x)) ^ (2 * ~n), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~A, ~B], ~x) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && Not(IntegerQ(~n)))
    @apply_utils Antiderivative((~A + ~(B') * cot(~(d') + ~(e') * ~x)) * (~a + ~(b') * cot(~(d') + ~(e') * ~x) + ~(c') * cot(~(d') + ~(e') * ~x) ^ 2) ^ ~n, ~x) => ((~a + ~b * cot(~d + ~e * ~x) + ~c * cot(~d + ~e * ~x) ^ 2) ^ ~n / (~b + 2 * ~c * cot(~d + ~e * ~x)) ^ (2 * ~n)) * Antiderivative((~A + ~B * cot(~d + ~e * ~x)) * (~b + 2 * ~c * cot(~d + ~e * ~x)) ^ (2 * ~n), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~A, ~B], ~x) && (EqQ((~b) ^ 2 - 4 * ~a * ~c, 0) && Not(IntegerQ(~n)))
    @apply_utils Antiderivative((~A + ~(B') * tan(~(d') + ~(e') * ~x)) / (~(a') + ~(b') * tan(~(d') + ~(e') * ~x) + ~(c') * tan(~(d') + ~(e') * ~x) ^ 2), ~x) => Module([q = Rt((~b) ^ 2 - 4 * ~a * ~c, 2)], (~B + (~b * ~B - 2 * ~A * ~c) / q) * Antiderivative(1 / Simp(~b + q + 2 * ~c * tan(~d + ~e * ~x), ~x), ~x) + (~B - (~b * ~B - 2 * ~A * ~c) / q) * Antiderivative(1 / Simp((~b - q) + 2 * ~c * tan(~d + ~e * ~x), ~x), ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~A, ~B], ~x) && NeQ((~b) ^ 2 - 4 * ~a * ~c, 0)
    @apply_utils Antiderivative((~A + ~(B') * cot(~(d') + ~(e') * ~x)) / (~(a') + ~(b') * cot(~(d') + ~(e') * ~x) + ~(c') * cot(~(d') + ~(e') * ~x) ^ 2), ~x) => Module([q = Rt((~b) ^ 2 - 4 * ~a * ~c, 2)], (~B + (~b * ~B - 2 * ~A * ~c) / q) * Antiderivative(1 / Simp(~b + q + 2 * ~c * cot(~d + ~e * ~x), ~x), ~x) + (~B - (~b * ~B - 2 * ~A * ~c) / q) * Antiderivative(1 / Simp((~b - q) + 2 * ~c * cot(~d + ~e * ~x), ~x), ~x)) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~A, ~B], ~x) && NeQ((~b) ^ 2 - 4 * ~a * ~c, 0)
    @apply_utils Antiderivative((~A + ~(B') * tan(~(d') + ~(e') * ~x)) * (~(a') + ~(b') * tan(~(d') + ~(e') * ~x) + ~(c') * tan(~(d') + ~(e') * ~x) ^ 2) ^ ~n, ~x) => Antiderivative(ExpandTrig((~A + ~B * tan(~d + ~e * ~x)) * (~a + ~b * tan(~d + ~e * ~x) + ~c * tan(~d + ~e * ~x) ^ 2) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~A, ~B], ~x) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IntegerQ(~n))
    @apply_utils Antiderivative((~A + ~(B') * cot(~(d') + ~(e') * ~x)) * (~(a') + ~(b') * cot(~(d') + ~(e') * ~x) + ~(c') * cot(~(d') + ~(e') * ~x) ^ 2) ^ ~n, ~x) => Antiderivative(ExpandTrig((~A + ~B * cot(~d + ~e * ~x)) * (~a + ~b * cot(~d + ~e * ~x) + ~c * cot(~d + ~e * ~x) ^ 2) ^ ~n, ~x), ~x) <-- FreeQ([~a, ~b, ~c, ~d, ~e, ~A, ~B], ~x) && (NeQ((~b) ^ 2 - 4 * ~a * ~c, 0) && IntegerQ(~n))
end
