#include <tgmath.h>
#include <gmp.h>
#include <mpfr.h>
#include <stdio.h>
#include <stdbool.h>

char *name = "(* (+ (log d) (fabs c)) (tan d))";

double f_if(float __attribute__((unused)) a, float __attribute__((unused)) b, float c, float d) {
        float r15515 = d;
        float r15516 = log(r15515);
        float r15517 = c;
        float r15518 = fabs(r15517);
        float r15519 = r15516 + r15518;
        float r15520 = tan(r15515);
        float r15521 = r15519 * r15520;
        return r15521;
}

double f_id(double __attribute__((unused)) a, double __attribute__((unused)) b, double c, double d) {
        double r15522 = d;
        double r15523 = log(r15522);
        double r15524 = c;
        double r15525 = fabs(r15524);
        double r15526 = r15523 + r15525;
        double r15527 = tan(r15522);
        double r15528 = r15526 * r15527;
        return r15528;
}


double f_of(float __attribute__((unused)) a, float __attribute__((unused)) b, float c, float d) {
        float r15529 = d;
        float r15530 = log(r15529);
        float r15531 = c;
        float r15532 = fabs(r15531);
        float r15533 = r15530 + r15532;
        float r15534 = tan(r15529);
        float r15535 = r15533 * r15534;
        return r15535;
}

double f_od(double __attribute__((unused)) a, double __attribute__((unused)) b, double c, double d) {
        double r15536 = d;
        double r15537 = log(r15536);
        double r15538 = c;
        double r15539 = fabs(r15538);
        double r15540 = r15537 + r15539;
        double r15541 = tan(r15536);
        double r15542 = r15540 * r15541;
        return r15542;
}

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 r15543, r15544, r15545, r15546, r15547, r15548, r15549;

void setup_mpfr_f_im() {
        mpfr_set_default_prec(144);
        mpfr_init(r15543);
        mpfr_init(r15544);
        mpfr_init(r15545);
        mpfr_init(r15546);
        mpfr_init(r15547);
        mpfr_init(r15548);
        mpfr_init(r15549);
}

double f_im(double __attribute__((unused)) a, double __attribute__((unused)) b, double c, double d) {
        mpfr_set_d(r15543, d, MPFR_RNDN);
        mpfr_log(r15544, r15543, MPFR_RNDN);
        mpfr_set_d(r15545, c, MPFR_RNDN);
        mpfr_abs(r15546, r15545, MPFR_RNDN);
        mpfr_add(r15547, r15544, r15546, MPFR_RNDN);
        mpfr_tan(r15548, r15543, MPFR_RNDN);
        mpfr_mul(r15549, r15547, r15548, MPFR_RNDN);
        return mpfr_get_d(r15549, MPFR_RNDN);
}

static mpfr_t r15550, r15551, r15552, r15553, r15554, r15555, r15556;

void setup_mpfr_f_fm() {
        mpfr_set_default_prec(144);
        mpfr_init(r15550);
        mpfr_init(r15551);
        mpfr_init(r15552);
        mpfr_init(r15553);
        mpfr_init(r15554);
        mpfr_init(r15555);
        mpfr_init(r15556);
}

double f_fm(double __attribute__((unused)) a, double __attribute__((unused)) b, double c, double d) {
        mpfr_set_d(r15550, d, MPFR_RNDN);
        mpfr_log(r15551, r15550, MPFR_RNDN);
        mpfr_set_d(r15552, c, MPFR_RNDN);
        mpfr_abs(r15553, r15552, MPFR_RNDN);
        mpfr_add(r15554, r15551, r15553, MPFR_RNDN);
        mpfr_tan(r15555, r15550, MPFR_RNDN);
        mpfr_mul(r15556, r15554, r15555, MPFR_RNDN);
        return mpfr_get_d(r15556, MPFR_RNDN);
}

static mpfr_t r15557, r15558, r15559, r15560, r15561, r15562, r15563;

void setup_mpfr_f_dm() {
        mpfr_set_default_prec(144);
        mpfr_init(r15557);
        mpfr_init(r15558);
        mpfr_init(r15559);
        mpfr_init(r15560);
        mpfr_init(r15561);
        mpfr_init(r15562);
        mpfr_init(r15563);
}

double f_dm(double __attribute__((unused)) a, double __attribute__((unused)) b, double c, double d) {
        mpfr_set_d(r15557, d, MPFR_RNDN);
        mpfr_log(r15558, r15557, MPFR_RNDN);
        mpfr_set_d(r15559, c, MPFR_RNDN);
        mpfr_abs(r15560, r15559, MPFR_RNDN);
        mpfr_add(r15561, r15558, r15560, MPFR_RNDN);
        mpfr_tan(r15562, r15557, MPFR_RNDN);
        mpfr_mul(r15563, r15561, r15562, MPFR_RNDN);
        return mpfr_get_d(r15563, MPFR_RNDN);
}

