// Generated by using Rcpp::compileAttributes() -> do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#include "../inst/include/PoissonBinomial.h"
#include <Rcpp.h>
#include <string>
#include <set>

using namespace Rcpp;

// vectorGCD
int vectorGCD(const IntegerVector x);
static SEXP _PoissonBinomial_vectorGCD_try(SEXP xSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type x(xSEXP);
    rcpp_result_gen = Rcpp::wrap(vectorGCD(x));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_vectorGCD(SEXP xSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_vectorGCD_try(xSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dpb_conv
NumericVector dpb_conv(const IntegerVector obs, const NumericVector probs);
static SEXP _PoissonBinomial_dpb_conv_try(SEXP obsSEXP, SEXP probsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    rcpp_result_gen = Rcpp::wrap(dpb_conv(obs, probs));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_dpb_conv(SEXP obsSEXP, SEXP probsSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_dpb_conv_try(obsSEXP, probsSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// ppb_conv
NumericVector ppb_conv(const IntegerVector obs, const NumericVector probs, const bool lower_tail);
static SEXP _PoissonBinomial_ppb_conv_try(SEXP obsSEXP, SEXP probsSEXP, SEXP lower_tailSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const bool >::type lower_tail(lower_tailSEXP);
    rcpp_result_gen = Rcpp::wrap(ppb_conv(obs, probs, lower_tail));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_ppb_conv(SEXP obsSEXP, SEXP probsSEXP, SEXP lower_tailSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_ppb_conv_try(obsSEXP, probsSEXP, lower_tailSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dpb_dc
NumericVector dpb_dc(const IntegerVector obs, const NumericVector probs);
static SEXP _PoissonBinomial_dpb_dc_try(SEXP obsSEXP, SEXP probsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    rcpp_result_gen = Rcpp::wrap(dpb_dc(obs, probs));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_dpb_dc(SEXP obsSEXP, SEXP probsSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_dpb_dc_try(obsSEXP, probsSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// ppb_dc
NumericVector ppb_dc(const IntegerVector obs, const NumericVector probs, const bool lower_tail);
static SEXP _PoissonBinomial_ppb_dc_try(SEXP obsSEXP, SEXP probsSEXP, SEXP lower_tailSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const bool >::type lower_tail(lower_tailSEXP);
    rcpp_result_gen = Rcpp::wrap(ppb_dc(obs, probs, lower_tail));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_ppb_dc(SEXP obsSEXP, SEXP probsSEXP, SEXP lower_tailSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_ppb_dc_try(obsSEXP, probsSEXP, lower_tailSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dpb_dftcf
NumericVector dpb_dftcf(const IntegerVector obs, const NumericVector probs);
static SEXP _PoissonBinomial_dpb_dftcf_try(SEXP obsSEXP, SEXP probsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    rcpp_result_gen = Rcpp::wrap(dpb_dftcf(obs, probs));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_dpb_dftcf(SEXP obsSEXP, SEXP probsSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_dpb_dftcf_try(obsSEXP, probsSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// ppb_dftcf
NumericVector ppb_dftcf(const IntegerVector obs, const NumericVector probs, const bool lower_tail);
static SEXP _PoissonBinomial_ppb_dftcf_try(SEXP obsSEXP, SEXP probsSEXP, SEXP lower_tailSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const bool >::type lower_tail(lower_tailSEXP);
    rcpp_result_gen = Rcpp::wrap(ppb_dftcf(obs, probs, lower_tail));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_ppb_dftcf(SEXP obsSEXP, SEXP probsSEXP, SEXP lower_tailSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_ppb_dftcf_try(obsSEXP, probsSEXP, lower_tailSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dpb_rf
NumericVector dpb_rf(const IntegerVector obs, const NumericVector probs);
static SEXP _PoissonBinomial_dpb_rf_try(SEXP obsSEXP, SEXP probsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    rcpp_result_gen = Rcpp::wrap(dpb_rf(obs, probs));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_dpb_rf(SEXP obsSEXP, SEXP probsSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_dpb_rf_try(obsSEXP, probsSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// ppb_rf
NumericVector ppb_rf(const IntegerVector obs, const NumericVector probs, const bool lower_tail);
static SEXP _PoissonBinomial_ppb_rf_try(SEXP obsSEXP, SEXP probsSEXP, SEXP lower_tailSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const bool >::type lower_tail(lower_tailSEXP);
    rcpp_result_gen = Rcpp::wrap(ppb_rf(obs, probs, lower_tail));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_ppb_rf(SEXP obsSEXP, SEXP probsSEXP, SEXP lower_tailSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_ppb_rf_try(obsSEXP, probsSEXP, lower_tailSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dpb_mean
NumericVector dpb_mean(IntegerVector obs, const NumericVector probs);
static SEXP _PoissonBinomial_dpb_mean_try(SEXP obsSEXP, SEXP probsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    rcpp_result_gen = Rcpp::wrap(dpb_mean(obs, probs));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_dpb_mean(SEXP obsSEXP, SEXP probsSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_dpb_mean_try(obsSEXP, probsSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// ppb_mean
NumericVector ppb_mean(const IntegerVector obs, const NumericVector probs, const bool lower_tail);
static SEXP _PoissonBinomial_ppb_mean_try(SEXP obsSEXP, SEXP probsSEXP, SEXP lower_tailSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const bool >::type lower_tail(lower_tailSEXP);
    rcpp_result_gen = Rcpp::wrap(ppb_mean(obs, probs, lower_tail));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_ppb_mean(SEXP obsSEXP, SEXP probsSEXP, SEXP lower_tailSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_ppb_mean_try(obsSEXP, probsSEXP, lower_tailSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dpb_gmba
NumericVector dpb_gmba(const IntegerVector obs, const NumericVector probs, const bool anti);
static SEXP _PoissonBinomial_dpb_gmba_try(SEXP obsSEXP, SEXP probsSEXP, SEXP antiSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const bool >::type anti(antiSEXP);
    rcpp_result_gen = Rcpp::wrap(dpb_gmba(obs, probs, anti));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_dpb_gmba(SEXP obsSEXP, SEXP probsSEXP, SEXP antiSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_dpb_gmba_try(obsSEXP, probsSEXP, antiSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// ppb_gmba
NumericVector ppb_gmba(const IntegerVector obs, const NumericVector probs, const bool anti, const bool lower_tail);
static SEXP _PoissonBinomial_ppb_gmba_try(SEXP obsSEXP, SEXP probsSEXP, SEXP antiSEXP, SEXP lower_tailSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const bool >::type anti(antiSEXP);
    Rcpp::traits::input_parameter< const bool >::type lower_tail(lower_tailSEXP);
    rcpp_result_gen = Rcpp::wrap(ppb_gmba(obs, probs, anti, lower_tail));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_ppb_gmba(SEXP obsSEXP, SEXP probsSEXP, SEXP antiSEXP, SEXP lower_tailSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_ppb_gmba_try(obsSEXP, probsSEXP, antiSEXP, lower_tailSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dpb_pa
NumericVector dpb_pa(const IntegerVector obs, const NumericVector probs);
static SEXP _PoissonBinomial_dpb_pa_try(SEXP obsSEXP, SEXP probsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    rcpp_result_gen = Rcpp::wrap(dpb_pa(obs, probs));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_dpb_pa(SEXP obsSEXP, SEXP probsSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_dpb_pa_try(obsSEXP, probsSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// ppb_pa
NumericVector ppb_pa(const IntegerVector obs, const NumericVector probs, bool lower_tail);
static SEXP _PoissonBinomial_ppb_pa_try(SEXP obsSEXP, SEXP probsSEXP, SEXP lower_tailSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< bool >::type lower_tail(lower_tailSEXP);
    rcpp_result_gen = Rcpp::wrap(ppb_pa(obs, probs, lower_tail));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_ppb_pa(SEXP obsSEXP, SEXP probsSEXP, SEXP lower_tailSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_ppb_pa_try(obsSEXP, probsSEXP, lower_tailSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// ppb_na
NumericVector ppb_na(const IntegerVector obs, const NumericVector probs, const bool refined, const bool lower_tail);
static SEXP _PoissonBinomial_ppb_na_try(SEXP obsSEXP, SEXP probsSEXP, SEXP refinedSEXP, SEXP lower_tailSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const bool >::type refined(refinedSEXP);
    Rcpp::traits::input_parameter< const bool >::type lower_tail(lower_tailSEXP);
    rcpp_result_gen = Rcpp::wrap(ppb_na(obs, probs, refined, lower_tail));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_ppb_na(SEXP obsSEXP, SEXP probsSEXP, SEXP refinedSEXP, SEXP lower_tailSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_ppb_na_try(obsSEXP, probsSEXP, refinedSEXP, lower_tailSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dpb_na
NumericVector dpb_na(const IntegerVector obs, const NumericVector probs, const bool refined);
static SEXP _PoissonBinomial_dpb_na_try(SEXP obsSEXP, SEXP probsSEXP, SEXP refinedSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const bool >::type refined(refinedSEXP);
    rcpp_result_gen = Rcpp::wrap(dpb_na(obs, probs, refined));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_dpb_na(SEXP obsSEXP, SEXP probsSEXP, SEXP refinedSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_dpb_na_try(obsSEXP, probsSEXP, refinedSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// rpb_bernoulli
IntegerVector rpb_bernoulli(const int n, const NumericVector probs);
static SEXP _PoissonBinomial_rpb_bernoulli_try(SEXP nSEXP, SEXP probsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const int >::type n(nSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    rcpp_result_gen = Rcpp::wrap(rpb_bernoulli(n, probs));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_rpb_bernoulli(SEXP nSEXP, SEXP probsSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_rpb_bernoulli_try(nSEXP, probsSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dgpb_conv
NumericVector dgpb_conv(const IntegerVector obs, const NumericVector probs, const IntegerVector val_p, const IntegerVector val_q);
static SEXP _PoissonBinomial_dgpb_conv_try(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_p(val_pSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_q(val_qSEXP);
    rcpp_result_gen = Rcpp::wrap(dgpb_conv(obs, probs, val_p, val_q));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_dgpb_conv(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_dgpb_conv_try(obsSEXP, probsSEXP, val_pSEXP, val_qSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// pgpb_conv
NumericVector pgpb_conv(const IntegerVector obs, const NumericVector probs, const IntegerVector val_p, const IntegerVector val_q, bool lower_tail);
static SEXP _PoissonBinomial_pgpb_conv_try(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP, SEXP lower_tailSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_p(val_pSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_q(val_qSEXP);
    Rcpp::traits::input_parameter< bool >::type lower_tail(lower_tailSEXP);
    rcpp_result_gen = Rcpp::wrap(pgpb_conv(obs, probs, val_p, val_q, lower_tail));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_pgpb_conv(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP, SEXP lower_tailSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_pgpb_conv_try(obsSEXP, probsSEXP, val_pSEXP, val_qSEXP, lower_tailSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dgpb_dc
NumericVector dgpb_dc(const IntegerVector obs, const NumericVector probs, const IntegerVector val_p, const IntegerVector val_q);
static SEXP _PoissonBinomial_dgpb_dc_try(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_p(val_pSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_q(val_qSEXP);
    rcpp_result_gen = Rcpp::wrap(dgpb_dc(obs, probs, val_p, val_q));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_dgpb_dc(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_dgpb_dc_try(obsSEXP, probsSEXP, val_pSEXP, val_qSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// pgpb_dc
NumericVector pgpb_dc(const IntegerVector obs, const NumericVector probs, const IntegerVector val_p, const IntegerVector val_q, const bool lower_tail);
static SEXP _PoissonBinomial_pgpb_dc_try(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP, SEXP lower_tailSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_p(val_pSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_q(val_qSEXP);
    Rcpp::traits::input_parameter< const bool >::type lower_tail(lower_tailSEXP);
    rcpp_result_gen = Rcpp::wrap(pgpb_dc(obs, probs, val_p, val_q, lower_tail));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_pgpb_dc(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP, SEXP lower_tailSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_pgpb_dc_try(obsSEXP, probsSEXP, val_pSEXP, val_qSEXP, lower_tailSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dgpb_dftcf
NumericVector dgpb_dftcf(const IntegerVector obs, const NumericVector probs, const IntegerVector val_p, const IntegerVector val_q);
static SEXP _PoissonBinomial_dgpb_dftcf_try(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_p(val_pSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_q(val_qSEXP);
    rcpp_result_gen = Rcpp::wrap(dgpb_dftcf(obs, probs, val_p, val_q));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_dgpb_dftcf(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_dgpb_dftcf_try(obsSEXP, probsSEXP, val_pSEXP, val_qSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// pgpb_dftcf
NumericVector pgpb_dftcf(const IntegerVector obs, const NumericVector probs, const IntegerVector val_p, const IntegerVector val_q, const bool lower_tail);
static SEXP _PoissonBinomial_pgpb_dftcf_try(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP, SEXP lower_tailSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_p(val_pSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_q(val_qSEXP);
    Rcpp::traits::input_parameter< const bool >::type lower_tail(lower_tailSEXP);
    rcpp_result_gen = Rcpp::wrap(pgpb_dftcf(obs, probs, val_p, val_q, lower_tail));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_pgpb_dftcf(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP, SEXP lower_tailSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_pgpb_dftcf_try(obsSEXP, probsSEXP, val_pSEXP, val_qSEXP, lower_tailSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// pgpb_na
NumericVector pgpb_na(const IntegerVector obs, const NumericVector probs, const IntegerVector val_p, const IntegerVector val_q, const bool refined, const bool lower_tail);
static SEXP _PoissonBinomial_pgpb_na_try(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP, SEXP refinedSEXP, SEXP lower_tailSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_p(val_pSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_q(val_qSEXP);
    Rcpp::traits::input_parameter< const bool >::type refined(refinedSEXP);
    Rcpp::traits::input_parameter< const bool >::type lower_tail(lower_tailSEXP);
    rcpp_result_gen = Rcpp::wrap(pgpb_na(obs, probs, val_p, val_q, refined, lower_tail));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_pgpb_na(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP, SEXP refinedSEXP, SEXP lower_tailSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_pgpb_na_try(obsSEXP, probsSEXP, val_pSEXP, val_qSEXP, refinedSEXP, lower_tailSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// dgpb_na
NumericVector dgpb_na(const IntegerVector obs, const NumericVector probs, const IntegerVector val_p, const IntegerVector val_q, const bool refined);
static SEXP _PoissonBinomial_dgpb_na_try(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP, SEXP refinedSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const IntegerVector >::type obs(obsSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_p(val_pSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_q(val_qSEXP);
    Rcpp::traits::input_parameter< const bool >::type refined(refinedSEXP);
    rcpp_result_gen = Rcpp::wrap(dgpb_na(obs, probs, val_p, val_q, refined));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_dgpb_na(SEXP obsSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP, SEXP refinedSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_dgpb_na_try(obsSEXP, probsSEXP, val_pSEXP, val_qSEXP, refinedSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}
// rgpb_bernoulli
IntegerVector rgpb_bernoulli(const int n, const NumericVector probs, const IntegerVector val_p, const IntegerVector val_q);
static SEXP _PoissonBinomial_rgpb_bernoulli_try(SEXP nSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::traits::input_parameter< const int >::type n(nSEXP);
    Rcpp::traits::input_parameter< const NumericVector >::type probs(probsSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_p(val_pSEXP);
    Rcpp::traits::input_parameter< const IntegerVector >::type val_q(val_qSEXP);
    rcpp_result_gen = Rcpp::wrap(rgpb_bernoulli(n, probs, val_p, val_q));
    return rcpp_result_gen;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP _PoissonBinomial_rgpb_bernoulli(SEXP nSEXP, SEXP probsSEXP, SEXP val_pSEXP, SEXP val_qSEXP) {
    SEXP rcpp_result_gen;
    {
        Rcpp::RNGScope rcpp_rngScope_gen;
        rcpp_result_gen = PROTECT(_PoissonBinomial_rgpb_bernoulli_try(nSEXP, probsSEXP, val_pSEXP, val_qSEXP));
    }
    Rboolean rcpp_isInterrupt_gen = Rf_inherits(rcpp_result_gen, "interrupted-error");
    if (rcpp_isInterrupt_gen) {
        UNPROTECT(1);
        Rf_onintr();
    }
    bool rcpp_isLongjump_gen = Rcpp::internal::isLongjumpSentinel(rcpp_result_gen);
    if (rcpp_isLongjump_gen) {
        Rcpp::internal::resumeJump(rcpp_result_gen);
    }
    Rboolean rcpp_isError_gen = Rf_inherits(rcpp_result_gen, "try-error");
    if (rcpp_isError_gen) {
        SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
        UNPROTECT(1);
        Rf_error(CHAR(rcpp_msgSEXP_gen));
    }
    UNPROTECT(1);
    return rcpp_result_gen;
}

// validate (ensure exported C++ functions exist before calling them)
static int _PoissonBinomial_RcppExport_validate(const char* sig) { 
    static std::set<std::string> signatures;
    if (signatures.empty()) {
        signatures.insert("int(*vectorGCD)(const IntegerVector)");
        signatures.insert("NumericVector(*dpb_conv)(const IntegerVector,const NumericVector)");
        signatures.insert("NumericVector(*ppb_conv)(const IntegerVector,const NumericVector,const bool)");
        signatures.insert("NumericVector(*dpb_dc)(const IntegerVector,const NumericVector)");
        signatures.insert("NumericVector(*ppb_dc)(const IntegerVector,const NumericVector,const bool)");
        signatures.insert("NumericVector(*dpb_dftcf)(const IntegerVector,const NumericVector)");
        signatures.insert("NumericVector(*ppb_dftcf)(const IntegerVector,const NumericVector,const bool)");
        signatures.insert("NumericVector(*dpb_rf)(const IntegerVector,const NumericVector)");
        signatures.insert("NumericVector(*ppb_rf)(const IntegerVector,const NumericVector,const bool)");
        signatures.insert("NumericVector(*dpb_mean)(IntegerVector,const NumericVector)");
        signatures.insert("NumericVector(*ppb_mean)(const IntegerVector,const NumericVector,const bool)");
        signatures.insert("NumericVector(*dpb_gmba)(const IntegerVector,const NumericVector,const bool)");
        signatures.insert("NumericVector(*ppb_gmba)(const IntegerVector,const NumericVector,const bool,const bool)");
        signatures.insert("NumericVector(*dpb_pa)(const IntegerVector,const NumericVector)");
        signatures.insert("NumericVector(*ppb_pa)(const IntegerVector,const NumericVector,bool)");
        signatures.insert("NumericVector(*ppb_na)(const IntegerVector,const NumericVector,const bool,const bool)");
        signatures.insert("NumericVector(*dpb_na)(const IntegerVector,const NumericVector,const bool)");
        signatures.insert("IntegerVector(*rpb_bernoulli)(const int,const NumericVector)");
        signatures.insert("NumericVector(*dgpb_conv)(const IntegerVector,const NumericVector,const IntegerVector,const IntegerVector)");
        signatures.insert("NumericVector(*pgpb_conv)(const IntegerVector,const NumericVector,const IntegerVector,const IntegerVector,bool)");
        signatures.insert("NumericVector(*dgpb_dc)(const IntegerVector,const NumericVector,const IntegerVector,const IntegerVector)");
        signatures.insert("NumericVector(*pgpb_dc)(const IntegerVector,const NumericVector,const IntegerVector,const IntegerVector,const bool)");
        signatures.insert("NumericVector(*dgpb_dftcf)(const IntegerVector,const NumericVector,const IntegerVector,const IntegerVector)");
        signatures.insert("NumericVector(*pgpb_dftcf)(const IntegerVector,const NumericVector,const IntegerVector,const IntegerVector,const bool)");
        signatures.insert("NumericVector(*pgpb_na)(const IntegerVector,const NumericVector,const IntegerVector,const IntegerVector,const bool,const bool)");
        signatures.insert("NumericVector(*dgpb_na)(const IntegerVector,const NumericVector,const IntegerVector,const IntegerVector,const bool)");
        signatures.insert("IntegerVector(*rgpb_bernoulli)(const int,const NumericVector,const IntegerVector,const IntegerVector)");
    }
    return signatures.find(sig) != signatures.end();
}

// registerCCallable (register entry points for exported C++ functions)
RcppExport SEXP _PoissonBinomial_RcppExport_registerCCallable() { 
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_vectorGCD", (DL_FUNC)_PoissonBinomial_vectorGCD_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_dpb_conv", (DL_FUNC)_PoissonBinomial_dpb_conv_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_ppb_conv", (DL_FUNC)_PoissonBinomial_ppb_conv_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_dpb_dc", (DL_FUNC)_PoissonBinomial_dpb_dc_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_ppb_dc", (DL_FUNC)_PoissonBinomial_ppb_dc_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_dpb_dftcf", (DL_FUNC)_PoissonBinomial_dpb_dftcf_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_ppb_dftcf", (DL_FUNC)_PoissonBinomial_ppb_dftcf_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_dpb_rf", (DL_FUNC)_PoissonBinomial_dpb_rf_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_ppb_rf", (DL_FUNC)_PoissonBinomial_ppb_rf_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_dpb_mean", (DL_FUNC)_PoissonBinomial_dpb_mean_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_ppb_mean", (DL_FUNC)_PoissonBinomial_ppb_mean_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_dpb_gmba", (DL_FUNC)_PoissonBinomial_dpb_gmba_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_ppb_gmba", (DL_FUNC)_PoissonBinomial_ppb_gmba_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_dpb_pa", (DL_FUNC)_PoissonBinomial_dpb_pa_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_ppb_pa", (DL_FUNC)_PoissonBinomial_ppb_pa_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_ppb_na", (DL_FUNC)_PoissonBinomial_ppb_na_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_dpb_na", (DL_FUNC)_PoissonBinomial_dpb_na_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_rpb_bernoulli", (DL_FUNC)_PoissonBinomial_rpb_bernoulli_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_dgpb_conv", (DL_FUNC)_PoissonBinomial_dgpb_conv_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_pgpb_conv", (DL_FUNC)_PoissonBinomial_pgpb_conv_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_dgpb_dc", (DL_FUNC)_PoissonBinomial_dgpb_dc_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_pgpb_dc", (DL_FUNC)_PoissonBinomial_pgpb_dc_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_dgpb_dftcf", (DL_FUNC)_PoissonBinomial_dgpb_dftcf_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_pgpb_dftcf", (DL_FUNC)_PoissonBinomial_pgpb_dftcf_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_pgpb_na", (DL_FUNC)_PoissonBinomial_pgpb_na_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_dgpb_na", (DL_FUNC)_PoissonBinomial_dgpb_na_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_rgpb_bernoulli", (DL_FUNC)_PoissonBinomial_rgpb_bernoulli_try);
    R_RegisterCCallable("PoissonBinomial", "_PoissonBinomial_RcppExport_validate", (DL_FUNC)_PoissonBinomial_RcppExport_validate);
    return R_NilValue;
}

static const R_CallMethodDef CallEntries[] = {
    {"_PoissonBinomial_vectorGCD", (DL_FUNC) &_PoissonBinomial_vectorGCD, 1},
    {"_PoissonBinomial_dpb_conv", (DL_FUNC) &_PoissonBinomial_dpb_conv, 2},
    {"_PoissonBinomial_ppb_conv", (DL_FUNC) &_PoissonBinomial_ppb_conv, 3},
    {"_PoissonBinomial_dpb_dc", (DL_FUNC) &_PoissonBinomial_dpb_dc, 2},
    {"_PoissonBinomial_ppb_dc", (DL_FUNC) &_PoissonBinomial_ppb_dc, 3},
    {"_PoissonBinomial_dpb_dftcf", (DL_FUNC) &_PoissonBinomial_dpb_dftcf, 2},
    {"_PoissonBinomial_ppb_dftcf", (DL_FUNC) &_PoissonBinomial_ppb_dftcf, 3},
    {"_PoissonBinomial_dpb_rf", (DL_FUNC) &_PoissonBinomial_dpb_rf, 2},
    {"_PoissonBinomial_ppb_rf", (DL_FUNC) &_PoissonBinomial_ppb_rf, 3},
    {"_PoissonBinomial_dpb_mean", (DL_FUNC) &_PoissonBinomial_dpb_mean, 2},
    {"_PoissonBinomial_ppb_mean", (DL_FUNC) &_PoissonBinomial_ppb_mean, 3},
    {"_PoissonBinomial_dpb_gmba", (DL_FUNC) &_PoissonBinomial_dpb_gmba, 3},
    {"_PoissonBinomial_ppb_gmba", (DL_FUNC) &_PoissonBinomial_ppb_gmba, 4},
    {"_PoissonBinomial_dpb_pa", (DL_FUNC) &_PoissonBinomial_dpb_pa, 2},
    {"_PoissonBinomial_ppb_pa", (DL_FUNC) &_PoissonBinomial_ppb_pa, 3},
    {"_PoissonBinomial_ppb_na", (DL_FUNC) &_PoissonBinomial_ppb_na, 4},
    {"_PoissonBinomial_dpb_na", (DL_FUNC) &_PoissonBinomial_dpb_na, 3},
    {"_PoissonBinomial_rpb_bernoulli", (DL_FUNC) &_PoissonBinomial_rpb_bernoulli, 2},
    {"_PoissonBinomial_dgpb_conv", (DL_FUNC) &_PoissonBinomial_dgpb_conv, 4},
    {"_PoissonBinomial_pgpb_conv", (DL_FUNC) &_PoissonBinomial_pgpb_conv, 5},
    {"_PoissonBinomial_dgpb_dc", (DL_FUNC) &_PoissonBinomial_dgpb_dc, 4},
    {"_PoissonBinomial_pgpb_dc", (DL_FUNC) &_PoissonBinomial_pgpb_dc, 5},
    {"_PoissonBinomial_dgpb_dftcf", (DL_FUNC) &_PoissonBinomial_dgpb_dftcf, 4},
    {"_PoissonBinomial_pgpb_dftcf", (DL_FUNC) &_PoissonBinomial_pgpb_dftcf, 5},
    {"_PoissonBinomial_pgpb_na", (DL_FUNC) &_PoissonBinomial_pgpb_na, 6},
    {"_PoissonBinomial_dgpb_na", (DL_FUNC) &_PoissonBinomial_dgpb_na, 5},
    {"_PoissonBinomial_rgpb_bernoulli", (DL_FUNC) &_PoissonBinomial_rgpb_bernoulli, 4},
    {"_PoissonBinomial_RcppExport_registerCCallable", (DL_FUNC) &_PoissonBinomial_RcppExport_registerCCallable, 0},
    {NULL, NULL, 0}
};

RcppExport void R_init_PoissonBinomial(DllInfo *dll) {
    R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
    R_useDynamicSymbols(dll, FALSE);
}
