#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 r32164 = c0;
        float r32165 = 2;
        float r32166 = w;
        float r32167 = r32165 * r32166;
        float r32168 = r32164 / r32167;
        float r32169 = d;
        float r32170 = r32169 * r32169;
        float r32171 = r32164 * r32170;
        float r32172 = h;
        float r32173 = r32166 * r32172;
        float r32174 = D;
        float r32175 = r32174 * r32174;
        float r32176 = r32173 * r32175;
        float r32177 = r32171 / r32176;
        float r32178 = r32177 * r32177;
        float r32179 = M;
        float r32180 = r32179 * r32179;
        float r32181 = r32178 - r32180;
        float r32182 = sqrt(r32181);
        float r32183 = r32177 + r32182;
        float r32184 = r32168 * r32183;
        return r32184;
}

double f_id(double c0, double w, double h, double D, double d, double M) {
        double r32185 = c0;
        double r32186 = 2;
        double r32187 = w;
        double r32188 = r32186 * r32187;
        double r32189 = r32185 / r32188;
        double r32190 = d;
        double r32191 = r32190 * r32190;
        double r32192 = r32185 * r32191;
        double r32193 = h;
        double r32194 = r32187 * r32193;
        double r32195 = D;
        double r32196 = r32195 * r32195;
        double r32197 = r32194 * r32196;
        double r32198 = r32192 / r32197;
        double r32199 = r32198 * r32198;
        double r32200 = M;
        double r32201 = r32200 * r32200;
        double r32202 = r32199 - r32201;
        double r32203 = sqrt(r32202);
        double r32204 = r32198 + r32203;
        double r32205 = r32189 * r32204;
        return r32205;
}


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

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

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 r32208, r32209, r32210, r32211, r32212, r32213, r32214, r32215, r32216, r32217, r32218, r32219, r32220, r32221, r32222, r32223, r32224, r32225, r32226, r32227, r32228;

void setup_mpfr_f_im() {
        mpfr_set_default_prec(2960);
        mpfr_init(r32208);
        mpfr_init_set_str(r32209, "2", 10, MPFR_RNDN);
        mpfr_init(r32210);
        mpfr_init(r32211);
        mpfr_init(r32212);
        mpfr_init(r32213);
        mpfr_init(r32214);
        mpfr_init(r32215);
        mpfr_init(r32216);
        mpfr_init(r32217);
        mpfr_init(r32218);
        mpfr_init(r32219);
        mpfr_init(r32220);
        mpfr_init(r32221);
        mpfr_init(r32222);
        mpfr_init(r32223);
        mpfr_init(r32224);
        mpfr_init(r32225);
        mpfr_init(r32226);
        mpfr_init(r32227);
        mpfr_init(r32228);
}

double f_im(double c0, double w, double h, double D, double d, double M) {
        mpfr_set_d(r32208, c0, MPFR_RNDN);
        ;
        mpfr_set_d(r32210, w, MPFR_RNDN);
        mpfr_mul(r32211, r32209, r32210, MPFR_RNDN);
        mpfr_div(r32212, r32208, r32211, MPFR_RNDN);
        mpfr_set_d(r32213, d, MPFR_RNDN);
        mpfr_mul(r32214, r32213, r32213, MPFR_RNDN);
        mpfr_mul(r32215, r32208, r32214, MPFR_RNDN);
        mpfr_set_d(r32216, h, MPFR_RNDN);
        mpfr_mul(r32217, r32210, r32216, MPFR_RNDN);
        mpfr_set_d(r32218, D, MPFR_RNDN);
        mpfr_mul(r32219, r32218, r32218, MPFR_RNDN);
        mpfr_mul(r32220, r32217, r32219, MPFR_RNDN);
        mpfr_div(r32221, r32215, r32220, MPFR_RNDN);
        mpfr_mul(r32222, r32221, r32221, MPFR_RNDN);
        mpfr_set_d(r32223, M, MPFR_RNDN);
        mpfr_mul(r32224, r32223, r32223, MPFR_RNDN);
        mpfr_sub(r32225, r32222, r32224, MPFR_RNDN);
        mpfr_sqrt(r32226, r32225, MPFR_RNDN);
        mpfr_add(r32227, r32221, r32226, MPFR_RNDN);
        mpfr_mul(r32228, r32212, r32227, MPFR_RNDN);
        return mpfr_get_d(r32228, MPFR_RNDN);
}

static mpfr_t r32229;

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

static mpfr_t r32230;

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

