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

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


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

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

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

void setup_mpfr_f_im() {
        mpfr_set_default_prec(7056);
        mpfr_init(r23158);
        mpfr_init_set_str(r23159, "2", 10, MPFR_RNDN);
        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);
        mpfr_init(r23176);
        mpfr_init(r23177);
        mpfr_init(r23178);
}

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

static mpfr_t r23179;

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

static mpfr_t r23180;

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

