#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 r31912 = c0;
        float r31913 = 2;
        float r31914 = w;
        float r31915 = r31913 * r31914;
        float r31916 = r31912 / r31915;
        float r31917 = d;
        float r31918 = r31917 * r31917;
        float r31919 = r31912 * r31918;
        float r31920 = h;
        float r31921 = r31914 * r31920;
        float r31922 = D;
        float r31923 = r31922 * r31922;
        float r31924 = r31921 * r31923;
        float r31925 = r31919 / r31924;
        float r31926 = r31925 * r31925;
        float r31927 = M;
        float r31928 = r31927 * r31927;
        float r31929 = r31926 - r31928;
        float r31930 = sqrt(r31929);
        float r31931 = r31925 + r31930;
        float r31932 = r31916 * r31931;
        return r31932;
}

double f_id(double c0, double w, double h, double D, double d, double M) {
        double r31933 = c0;
        double r31934 = 2;
        double r31935 = w;
        double r31936 = r31934 * r31935;
        double r31937 = r31933 / r31936;
        double r31938 = d;
        double r31939 = r31938 * r31938;
        double r31940 = r31933 * r31939;
        double r31941 = h;
        double r31942 = r31935 * r31941;
        double r31943 = D;
        double r31944 = r31943 * r31943;
        double r31945 = r31942 * r31944;
        double r31946 = r31940 / r31945;
        double r31947 = r31946 * r31946;
        double r31948 = M;
        double r31949 = r31948 * r31948;
        double r31950 = r31947 - r31949;
        double r31951 = sqrt(r31950);
        double r31952 = r31946 + r31951;
        double r31953 = r31937 * r31952;
        return r31953;
}


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

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

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 r31956, r31957, r31958, r31959, r31960, r31961, r31962, r31963, r31964, r31965, r31966, r31967, r31968, r31969, r31970, r31971, r31972, r31973, r31974, r31975, r31976;

void setup_mpfr_f_im() {
        mpfr_set_default_prec(2960);
        mpfr_init(r31956);
        mpfr_init_set_str(r31957, "2", 10, MPFR_RNDN);
        mpfr_init(r31958);
        mpfr_init(r31959);
        mpfr_init(r31960);
        mpfr_init(r31961);
        mpfr_init(r31962);
        mpfr_init(r31963);
        mpfr_init(r31964);
        mpfr_init(r31965);
        mpfr_init(r31966);
        mpfr_init(r31967);
        mpfr_init(r31968);
        mpfr_init(r31969);
        mpfr_init(r31970);
        mpfr_init(r31971);
        mpfr_init(r31972);
        mpfr_init(r31973);
        mpfr_init(r31974);
        mpfr_init(r31975);
        mpfr_init(r31976);
}

double f_im(double c0, double w, double h, double D, double d, double M) {
        mpfr_set_d(r31956, c0, MPFR_RNDN);
        ;
        mpfr_set_d(r31958, w, MPFR_RNDN);
        mpfr_mul(r31959, r31957, r31958, MPFR_RNDN);
        mpfr_div(r31960, r31956, r31959, MPFR_RNDN);
        mpfr_set_d(r31961, d, MPFR_RNDN);
        mpfr_mul(r31962, r31961, r31961, MPFR_RNDN);
        mpfr_mul(r31963, r31956, r31962, MPFR_RNDN);
        mpfr_set_d(r31964, h, MPFR_RNDN);
        mpfr_mul(r31965, r31958, r31964, MPFR_RNDN);
        mpfr_set_d(r31966, D, MPFR_RNDN);
        mpfr_mul(r31967, r31966, r31966, MPFR_RNDN);
        mpfr_mul(r31968, r31965, r31967, MPFR_RNDN);
        mpfr_div(r31969, r31963, r31968, MPFR_RNDN);
        mpfr_mul(r31970, r31969, r31969, MPFR_RNDN);
        mpfr_set_d(r31971, M, MPFR_RNDN);
        mpfr_mul(r31972, r31971, r31971, MPFR_RNDN);
        mpfr_sub(r31973, r31970, r31972, MPFR_RNDN);
        mpfr_sqrt(r31974, r31973, MPFR_RNDN);
        mpfr_add(r31975, r31969, r31974, MPFR_RNDN);
        mpfr_mul(r31976, r31960, r31975, MPFR_RNDN);
        return mpfr_get_d(r31976, MPFR_RNDN);
}

static mpfr_t r31977;

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

static mpfr_t r31978;

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

