#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 r23111 = c0;
        float r23112 = 2;
        float r23113 = w;
        float r23114 = r23112 * r23113;
        float r23115 = r23111 / r23114;
        float r23116 = d;
        float r23117 = r23116 * r23116;
        float r23118 = r23111 * r23117;
        float r23119 = h;
        float r23120 = r23113 * r23119;
        float r23121 = D;
        float r23122 = r23121 * r23121;
        float r23123 = r23120 * r23122;
        float r23124 = r23118 / r23123;
        float r23125 = r23124 * r23124;
        float r23126 = M;
        float r23127 = r23126 * r23126;
        float r23128 = r23125 - r23127;
        float r23129 = sqrt(r23128);
        float r23130 = r23124 + r23129;
        float r23131 = r23115 * r23130;
        return r23131;
}

double f_id(double c0, double w, double h, double D, double d, double M) {
        double r23132 = c0;
        double r23133 = 2;
        double r23134 = w;
        double r23135 = r23133 * r23134;
        double r23136 = r23132 / r23135;
        double r23137 = d;
        double r23138 = r23137 * r23137;
        double r23139 = r23132 * r23138;
        double r23140 = h;
        double r23141 = r23134 * r23140;
        double r23142 = D;
        double r23143 = r23142 * r23142;
        double r23144 = r23141 * r23143;
        double r23145 = r23139 / r23144;
        double r23146 = r23145 * r23145;
        double r23147 = M;
        double r23148 = r23147 * r23147;
        double r23149 = r23146 - r23148;
        double r23150 = sqrt(r23149);
        double r23151 = r23145 + r23150;
        double r23152 = r23136 * r23151;
        return r23152;
}


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 r23153 = +nan.0;
        return r23153;
}

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 r23154 = +nan.0;
        return r23154;
}

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 r23155, r23156, r23157, r23158, r23159, r23160, r23161, r23162, r23163, r23164, r23165, r23166, r23167, r23168, r23169, r23170, r23171, r23172, r23173, r23174, r23175;

void setup_mpfr_f_im() {
        mpfr_set_default_prec(7056);
        mpfr_init(r23155);
        mpfr_init_set_str(r23156, "2", 10, MPFR_RNDN);
        mpfr_init(r23157);
        mpfr_init(r23158);
        mpfr_init(r23159);
        mpfr_init(r23160);
        mpfr_init(r23161);
        mpfr_init(r23162);
        mpfr_init(r23163);
        mpfr_init(r23164);
        mpfr_init(r23165);
        mpfr_init(r23166);
        mpfr_init(r23167);
        mpfr_init(r23168);
        mpfr_init(r23169);
        mpfr_init(r23170);
        mpfr_init(r23171);
        mpfr_init(r23172);
        mpfr_init(r23173);
        mpfr_init(r23174);
        mpfr_init(r23175);
}

double f_im(double c0, double w, double h, double D, double d, double M) {
        mpfr_set_d(r23155, c0, MPFR_RNDN);
        ;
        mpfr_set_d(r23157, w, MPFR_RNDN);
        mpfr_mul(r23158, r23156, r23157, MPFR_RNDN);
        mpfr_div(r23159, r23155, r23158, MPFR_RNDN);
        mpfr_set_d(r23160, d, MPFR_RNDN);
        mpfr_mul(r23161, r23160, r23160, MPFR_RNDN);
        mpfr_mul(r23162, r23155, r23161, MPFR_RNDN);
        mpfr_set_d(r23163, h, MPFR_RNDN);
        mpfr_mul(r23164, r23157, r23163, MPFR_RNDN);
        mpfr_set_d(r23165, D, MPFR_RNDN);
        mpfr_mul(r23166, r23165, r23165, MPFR_RNDN);
        mpfr_mul(r23167, r23164, r23166, MPFR_RNDN);
        mpfr_div(r23168, r23162, r23167, MPFR_RNDN);
        mpfr_mul(r23169, r23168, r23168, MPFR_RNDN);
        mpfr_set_d(r23170, M, MPFR_RNDN);
        mpfr_mul(r23171, r23170, r23170, MPFR_RNDN);
        mpfr_sub(r23172, r23169, r23171, MPFR_RNDN);
        mpfr_sqrt(r23173, r23172, MPFR_RNDN);
        mpfr_add(r23174, r23168, r23173, MPFR_RNDN);
        mpfr_mul(r23175, r23159, r23174, MPFR_RNDN);
        return mpfr_get_d(r23175, MPFR_RNDN);
}

static mpfr_t r23176;

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

static mpfr_t r23177;

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

