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

char *name = "Henrywood and Agarwal, Equation (13)";

double f_if(float c0, float w, float h, float D, float d, float M) {
        float r31632 = c0;
        float r31633 = 2;
        float r31634 = w;
        float r31635 = r31633 * r31634;
        float r31636 = r31632 / r31635;
        float r31637 = d;
        float r31638 = r31637 * r31637;
        float r31639 = r31632 * r31638;
        float r31640 = h;
        float r31641 = r31634 * r31640;
        float r31642 = D;
        float r31643 = r31642 * r31642;
        float r31644 = r31641 * r31643;
        float r31645 = r31639 / r31644;
        float r31646 = r31645 * r31645;
        float r31647 = M;
        float r31648 = r31647 * r31647;
        float r31649 = r31646 - r31648;
        float r31650 = sqrt(r31649);
        float r31651 = r31645 + r31650;
        float r31652 = r31636 * r31651;
        return r31652;
}

double f_id(double c0, double w, double h, double D, double d, double M) {
        double r31653 = c0;
        double r31654 = 2;
        double r31655 = w;
        double r31656 = r31654 * r31655;
        double r31657 = r31653 / r31656;
        double r31658 = d;
        double r31659 = r31658 * r31658;
        double r31660 = r31653 * r31659;
        double r31661 = h;
        double r31662 = r31655 * r31661;
        double r31663 = D;
        double r31664 = r31663 * r31663;
        double r31665 = r31662 * r31664;
        double r31666 = r31660 / r31665;
        double r31667 = r31666 * r31666;
        double r31668 = M;
        double r31669 = r31668 * r31668;
        double r31670 = r31667 - r31669;
        double r31671 = sqrt(r31670);
        double r31672 = r31666 + r31671;
        double r31673 = r31657 * r31672;
        return r31673;
}


double f_of(float __attribute__((unused)) c0, float __attribute__((unused)) w, float __attribute__((unused)) h, float __attribute__((unused)) D, float __attribute__((unused)) d, float __attribute__((unused)) M) {
        float r31674 = 0;
        return r31674;
}

double f_od(double __attribute__((unused)) c0, double __attribute__((unused)) w, double __attribute__((unused)) h, double __attribute__((unused)) D, double __attribute__((unused)) d, double __attribute__((unused)) M) {
        double r31675 = 0;
        return r31675;
}

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 r31676, r31677, r31678, r31679, r31680, r31681, r31682, r31683, r31684, r31685, r31686, r31687, r31688, r31689, r31690, r31691, r31692, r31693, r31694, r31695, r31696;

void setup_mpfr_f_im() {
        mpfr_set_default_prec(2960);
        mpfr_init(r31676);
        mpfr_init_set_str(r31677, "2", 10, MPFR_RNDN);
        mpfr_init(r31678);
        mpfr_init(r31679);
        mpfr_init(r31680);
        mpfr_init(r31681);
        mpfr_init(r31682);
        mpfr_init(r31683);
        mpfr_init(r31684);
        mpfr_init(r31685);
        mpfr_init(r31686);
        mpfr_init(r31687);
        mpfr_init(r31688);
        mpfr_init(r31689);
        mpfr_init(r31690);
        mpfr_init(r31691);
        mpfr_init(r31692);
        mpfr_init(r31693);
        mpfr_init(r31694);
        mpfr_init(r31695);
        mpfr_init(r31696);
}

double f_im(double c0, double w, double h, double D, double d, double M) {
        mpfr_set_d(r31676, c0, MPFR_RNDN);
        ;
        mpfr_set_d(r31678, w, MPFR_RNDN);
        mpfr_mul(r31679, r31677, r31678, MPFR_RNDN);
        mpfr_div(r31680, r31676, r31679, MPFR_RNDN);
        mpfr_set_d(r31681, d, MPFR_RNDN);
        mpfr_mul(r31682, r31681, r31681, MPFR_RNDN);
        mpfr_mul(r31683, r31676, r31682, MPFR_RNDN);
        mpfr_set_d(r31684, h, MPFR_RNDN);
        mpfr_mul(r31685, r31678, r31684, MPFR_RNDN);
        mpfr_set_d(r31686, D, MPFR_RNDN);
        mpfr_mul(r31687, r31686, r31686, MPFR_RNDN);
        mpfr_mul(r31688, r31685, r31687, MPFR_RNDN);
        mpfr_div(r31689, r31683, r31688, MPFR_RNDN);
        mpfr_mul(r31690, r31689, r31689, MPFR_RNDN);
        mpfr_set_d(r31691, M, MPFR_RNDN);
        mpfr_mul(r31692, r31691, r31691, MPFR_RNDN);
        mpfr_sub(r31693, r31690, r31692, MPFR_RNDN);
        mpfr_sqrt(r31694, r31693, MPFR_RNDN);
        mpfr_add(r31695, r31689, r31694, MPFR_RNDN);
        mpfr_mul(r31696, r31680, r31695, MPFR_RNDN);
        return mpfr_get_d(r31696, MPFR_RNDN);
}

static mpfr_t r31697;

void setup_mpfr_f_fm() {
        mpfr_set_default_prec(2960);
        mpfr_init_set_str(r31697, "0", 10, MPFR_RNDN);
}

double f_fm(double __attribute__((unused)) c0, double __attribute__((unused)) w, double __attribute__((unused)) h, double __attribute__((unused)) D, double __attribute__((unused)) d, double __attribute__((unused)) M) {
        ;
        return mpfr_get_d(r31697, MPFR_RNDN);
}

static mpfr_t r31698;

void setup_mpfr_f_dm() {
        mpfr_set_default_prec(2960);
        mpfr_init_set_str(r31698, "0", 10, MPFR_RNDN);
}

double f_dm(double __attribute__((unused)) c0, double __attribute__((unused)) w, double __attribute__((unused)) h, double __attribute__((unused)) D, double __attribute__((unused)) d, double __attribute__((unused)) M) {
        ;
        return mpfr_get_d(r31698, MPFR_RNDN);
}

