#include <tgmath.h>
#include <gmp.h>
#include <mpfr.h>
#include <stdio.h>
#include <stdbool.h>

char *name = "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2";

double f_if(float x, float y, float z, float t, float a, float b) {
        float r15983 = x;
        float r15984 = y;
        float r15985 = z;
        float r15986 = log(r15985);
        float r15987 = r15984 * r15986;
        float r15988 = t;
        float r15989 = 1.0f;
        float r15990 = r15988 - r15989;
        float r15991 = a;
        float r15992 = log(r15991);
        float r15993 = r15990 * r15992;
        float r15994 = r15987 + r15993;
        float r15995 = b;
        float r15996 = r15994 - r15995;
        float r15997 = exp(r15996);
        float r15998 = r15983 * r15997;
        float r15999 = r15998 / r15984;
        return r15999;
}

double f_id(double x, double y, double z, double t, double a, double b) {
        double r16000 = x;
        double r16001 = y;
        double r16002 = z;
        double r16003 = log(r16002);
        double r16004 = r16001 * r16003;
        double r16005 = t;
        double r16006 = 1.0;
        double r16007 = r16005 - r16006;
        double r16008 = a;
        double r16009 = log(r16008);
        double r16010 = r16007 * r16009;
        double r16011 = r16004 + r16010;
        double r16012 = b;
        double r16013 = r16011 - r16012;
        double r16014 = exp(r16013);
        double r16015 = r16000 * r16014;
        double r16016 = r16015 / r16001;
        return r16016;
}


double f_of(float __attribute__((unused)) x, float __attribute__((unused)) y, float __attribute__((unused)) z, float __attribute__((unused)) t, float __attribute__((unused)) a, float __attribute__((unused)) b) {
        float r16017 = 0.0f;
        float r16018 = r16017 * r16017;
        return r16018;
}

double f_od(double __attribute__((unused)) x, double __attribute__((unused)) y, double __attribute__((unused)) z, double __attribute__((unused)) t, double __attribute__((unused)) a, double __attribute__((unused)) b) {
        double r16019 = 0.0;
        double r16020 = r16019 * r16019;
        return r16020;
}

void mpfr_fmod2(mpfr_t r, mpfr_t n, mpfr_t d, mpfr_rnd_t rmd) {
        mpfr_fmod(r, n, d, rmd);
        if (mpfr_cmp_ui(r, 0) < 0) mpfr_add(r, r, d, rmd);
}


static mpfr_t r16021, r16022, r16023, r16024, r16025, r16026, r16027, r16028, r16029, r16030, r16031, r16032, r16033, r16034, r16035, r16036, r16037;

void setup_mpfr_f_im() {
        mpfr_set_default_prec(144);
        mpfr_init(r16021);
        mpfr_init(r16022);
        mpfr_init(r16023);
        mpfr_init(r16024);
        mpfr_init(r16025);
        mpfr_init(r16026);
        mpfr_init_set_str(r16027, "1.0", 10, MPFR_RNDN);
        mpfr_init(r16028);
        mpfr_init(r16029);
        mpfr_init(r16030);
        mpfr_init(r16031);
        mpfr_init(r16032);
        mpfr_init(r16033);
        mpfr_init(r16034);
        mpfr_init(r16035);
        mpfr_init(r16036);
        mpfr_init(r16037);
}

double f_im(double x, double y, double z, double t, double a, double b) {
        mpfr_set_d(r16021, x, MPFR_RNDN);
        mpfr_set_d(r16022, y, MPFR_RNDN);
        mpfr_set_d(r16023, z, MPFR_RNDN);
        mpfr_log(r16024, r16023, MPFR_RNDN);
        mpfr_mul(r16025, r16022, r16024, MPFR_RNDN);
        mpfr_set_d(r16026, t, MPFR_RNDN);
        ;
        mpfr_sub(r16028, r16026, r16027, MPFR_RNDN);
        mpfr_set_d(r16029, a, MPFR_RNDN);
        mpfr_log(r16030, r16029, MPFR_RNDN);
        mpfr_mul(r16031, r16028, r16030, MPFR_RNDN);
        mpfr_add(r16032, r16025, r16031, MPFR_RNDN);
        mpfr_set_d(r16033, b, MPFR_RNDN);
        mpfr_sub(r16034, r16032, r16033, MPFR_RNDN);
        mpfr_exp(r16035, r16034, MPFR_RNDN);
        mpfr_mul(r16036, r16021, r16035, MPFR_RNDN);
        mpfr_div(r16037, r16036, r16022, MPFR_RNDN);
        return mpfr_get_d(r16037, MPFR_RNDN);
}

static mpfr_t r16038, r16039;

void setup_mpfr_f_fm() {
        mpfr_set_default_prec(144);
        mpfr_init_set_str(r16038, "0", 10, MPFR_RNDN);
        mpfr_init(r16039);
}

double f_fm(double __attribute__((unused)) x, double __attribute__((unused)) y, double __attribute__((unused)) z, double __attribute__((unused)) t, double __attribute__((unused)) a, double __attribute__((unused)) b) {
        ;
        mpfr_sqr(r16039, r16038, MPFR_RNDN);
        return mpfr_get_d(r16039, MPFR_RNDN);
}

static mpfr_t r16040, r16041;

void setup_mpfr_f_dm() {
        mpfr_set_default_prec(144);
        mpfr_init_set_str(r16040, "0", 10, MPFR_RNDN);
        mpfr_init(r16041);
}

double f_dm(double __attribute__((unused)) x, double __attribute__((unused)) y, double __attribute__((unused)) z, double __attribute__((unused)) t, double __attribute__((unused)) a, double __attribute__((unused)) b) {
        ;
        mpfr_sqr(r16041, r16040, MPFR_RNDN);
        return mpfr_get_d(r16041, MPFR_RNDN);
}

