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

char *name = "(- (atan2 (atan2 a c) a) (log a))";

double f_if(float a, float __attribute__((unused)) b, float c, float __attribute__((unused)) d) {
        float r15384 = a;
        float r15385 = c;
        float r15386 = atan2(r15384, r15385);
        float r15387 = atan2(r15386, r15384);
        float r15388 = log(r15384);
        float r15389 = r15387 - r15388;
        return r15389;
}

double f_id(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        double r15390 = a;
        double r15391 = c;
        double r15392 = atan2(r15390, r15391);
        double r15393 = atan2(r15392, r15390);
        double r15394 = log(r15390);
        double r15395 = r15393 - r15394;
        return r15395;
}


double f_of(float a, float __attribute__((unused)) b, float c, float __attribute__((unused)) d) {
        float r15396 = exp(1.0);
        float r15397 = a;
        float r15398 = c;
        float r15399 = atan2(r15397, r15398);
        float r15400 = atan2(r15399, r15397);
        float r15401 = pow(r15396, r15400);
        float r15402 = r15401 / r15397;
        float r15403 = log(r15402);
        return r15403;
}

double f_od(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        double r15404 = exp(1.0);
        double r15405 = a;
        double r15406 = c;
        double r15407 = atan2(r15405, r15406);
        double r15408 = atan2(r15407, r15405);
        double r15409 = pow(r15404, r15408);
        double r15410 = r15409 / r15405;
        double r15411 = log(r15410);
        return r15411;
}

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 r15412, r15413, r15414, r15415, r15416, r15417;

void setup_mpfr_f_im() {
        mpfr_set_default_prec(144);
        mpfr_init(r15412);
        mpfr_init(r15413);
        mpfr_init(r15414);
        mpfr_init(r15415);
        mpfr_init(r15416);
        mpfr_init(r15417);
}

double f_im(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        mpfr_set_d(r15412, a, MPFR_RNDN);
        mpfr_set_d(r15413, c, MPFR_RNDN);
        mpfr_atan2(r15414, r15412, r15413, MPFR_RNDN);
        mpfr_atan2(r15415, r15414, r15412, MPFR_RNDN);
        mpfr_log(r15416, r15412, MPFR_RNDN);
        mpfr_sub(r15417, r15415, r15416, MPFR_RNDN);
        return mpfr_get_d(r15417, MPFR_RNDN);
}

static mpfr_t r15418, r15419, r15420, r15421, r15422, r15423, r15424, r15425;

void setup_mpfr_f_fm() {
        mpfr_set_default_prec(144);
        mpfr_init(r15418);
        mpfr_init(r15419);
        mpfr_init(r15420);
        mpfr_init(r15421);
        mpfr_init(r15422);
        mpfr_init(r15423);
        mpfr_init(r15424);
        mpfr_init(r15425);
}

double f_fm(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        mpfr_set_si(r15418, 1, MPFR_RNDN); mpfr_exp(r15418, r15418, MPFR_RNDN);;
        mpfr_set_d(r15419, a, MPFR_RNDN);
        mpfr_set_d(r15420, c, MPFR_RNDN);
        mpfr_atan2(r15421, r15419, r15420, MPFR_RNDN);
        mpfr_atan2(r15422, r15421, r15419, MPFR_RNDN);
        mpfr_pow(r15423, r15418, r15422, MPFR_RNDN);
        mpfr_div(r15424, r15423, r15419, MPFR_RNDN);
        mpfr_log(r15425, r15424, MPFR_RNDN);
        return mpfr_get_d(r15425, MPFR_RNDN);
}

static mpfr_t r15426, r15427, r15428, r15429, r15430, r15431, r15432, r15433;

void setup_mpfr_f_dm() {
        mpfr_set_default_prec(144);
        mpfr_init(r15426);
        mpfr_init(r15427);
        mpfr_init(r15428);
        mpfr_init(r15429);
        mpfr_init(r15430);
        mpfr_init(r15431);
        mpfr_init(r15432);
        mpfr_init(r15433);
}

double f_dm(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        mpfr_set_si(r15426, 1, MPFR_RNDN); mpfr_exp(r15426, r15426, MPFR_RNDN);;
        mpfr_set_d(r15427, a, MPFR_RNDN);
        mpfr_set_d(r15428, c, MPFR_RNDN);
        mpfr_atan2(r15429, r15427, r15428, MPFR_RNDN);
        mpfr_atan2(r15430, r15429, r15427, MPFR_RNDN);
        mpfr_pow(r15431, r15426, r15430, MPFR_RNDN);
        mpfr_div(r15432, r15431, r15427, MPFR_RNDN);
        mpfr_log(r15433, r15432, MPFR_RNDN);
        return mpfr_get_d(r15433, MPFR_RNDN);
}

