#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 r21807 = c0;
        float r21808 = 2;
        float r21809 = w;
        float r21810 = r21808 * r21809;
        float r21811 = r21807 / r21810;
        float r21812 = d;
        float r21813 = r21812 * r21812;
        float r21814 = r21807 * r21813;
        float r21815 = h;
        float r21816 = r21809 * r21815;
        float r21817 = D;
        float r21818 = r21817 * r21817;
        float r21819 = r21816 * r21818;
        float r21820 = r21814 / r21819;
        float r21821 = r21820 * r21820;
        float r21822 = M;
        float r21823 = r21822 * r21822;
        float r21824 = r21821 - r21823;
        float r21825 = sqrt(r21824);
        float r21826 = r21820 + r21825;
        float r21827 = r21811 * r21826;
        return r21827;
}

double f_id(double c0, double w, double h, double D, double d, double M) {
        double r21828 = c0;
        double r21829 = 2;
        double r21830 = w;
        double r21831 = r21829 * r21830;
        double r21832 = r21828 / r21831;
        double r21833 = d;
        double r21834 = r21833 * r21833;
        double r21835 = r21828 * r21834;
        double r21836 = h;
        double r21837 = r21830 * r21836;
        double r21838 = D;
        double r21839 = r21838 * r21838;
        double r21840 = r21837 * r21839;
        double r21841 = r21835 / r21840;
        double r21842 = r21841 * r21841;
        double r21843 = M;
        double r21844 = r21843 * r21843;
        double r21845 = r21842 - r21844;
        double r21846 = sqrt(r21845);
        double r21847 = r21841 + r21846;
        double r21848 = r21832 * r21847;
        return r21848;
}


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 r21849 = 0;
        return r21849;
}

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 r21850 = 0;
        return r21850;
}

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 r21851, r21852, r21853, r21854, r21855, r21856, r21857, r21858, r21859, r21860, r21861, r21862, r21863, r21864, r21865, r21866, r21867, r21868, r21869, r21870, r21871;

void setup_mpfr_f_im() {
        mpfr_set_default_prec(7056);
        mpfr_init(r21851);
        mpfr_init_set_str(r21852, "2", 10, MPFR_RNDN);
        mpfr_init(r21853);
        mpfr_init(r21854);
        mpfr_init(r21855);
        mpfr_init(r21856);
        mpfr_init(r21857);
        mpfr_init(r21858);
        mpfr_init(r21859);
        mpfr_init(r21860);
        mpfr_init(r21861);
        mpfr_init(r21862);
        mpfr_init(r21863);
        mpfr_init(r21864);
        mpfr_init(r21865);
        mpfr_init(r21866);
        mpfr_init(r21867);
        mpfr_init(r21868);
        mpfr_init(r21869);
        mpfr_init(r21870);
        mpfr_init(r21871);
}

double f_im(double c0, double w, double h, double D, double d, double M) {
        mpfr_set_d(r21851, c0, MPFR_RNDN);
        ;
        mpfr_set_d(r21853, w, MPFR_RNDN);
        mpfr_mul(r21854, r21852, r21853, MPFR_RNDN);
        mpfr_div(r21855, r21851, r21854, MPFR_RNDN);
        mpfr_set_d(r21856, d, MPFR_RNDN);
        mpfr_mul(r21857, r21856, r21856, MPFR_RNDN);
        mpfr_mul(r21858, r21851, r21857, MPFR_RNDN);
        mpfr_set_d(r21859, h, MPFR_RNDN);
        mpfr_mul(r21860, r21853, r21859, MPFR_RNDN);
        mpfr_set_d(r21861, D, MPFR_RNDN);
        mpfr_mul(r21862, r21861, r21861, MPFR_RNDN);
        mpfr_mul(r21863, r21860, r21862, MPFR_RNDN);
        mpfr_div(r21864, r21858, r21863, MPFR_RNDN);
        mpfr_mul(r21865, r21864, r21864, MPFR_RNDN);
        mpfr_set_d(r21866, M, MPFR_RNDN);
        mpfr_mul(r21867, r21866, r21866, MPFR_RNDN);
        mpfr_sub(r21868, r21865, r21867, MPFR_RNDN);
        mpfr_sqrt(r21869, r21868, MPFR_RNDN);
        mpfr_add(r21870, r21864, r21869, MPFR_RNDN);
        mpfr_mul(r21871, r21855, r21870, MPFR_RNDN);
        return mpfr_get_d(r21871, MPFR_RNDN);
}

static mpfr_t r21872;

void setup_mpfr_f_fm() {
        mpfr_set_default_prec(7056);
        mpfr_init_set_str(r21872, "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(r21872, MPFR_RNDN);
}

static mpfr_t r21873;

void setup_mpfr_f_dm() {
        mpfr_set_default_prec(7056);
        mpfr_init_set_str(r21873, "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(r21873, MPFR_RNDN);
}

