#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 r15332 = a;
        float r15333 = c;
        float r15334 = atan2(r15332, r15333);
        float r15335 = atan2(r15334, r15332);
        float r15336 = log(r15332);
        float r15337 = r15335 - r15336;
        return r15337;
}

double f_id(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        double r15338 = a;
        double r15339 = c;
        double r15340 = atan2(r15338, r15339);
        double r15341 = atan2(r15340, r15338);
        double r15342 = log(r15338);
        double r15343 = r15341 - r15342;
        return r15343;
}


double f_of(float a, float __attribute__((unused)) b, float c, float __attribute__((unused)) d) {
        float r15344 = a;
        float r15345 = c;
        float r15346 = atan2(r15344, r15345);
        float r15347 = atan2(r15346, r15344);
        float r15348 = sqrt(r15347);
        float r15349 = r15348 * r15348;
        float r15350 = log(r15344);
        float r15351 = r15349 - r15350;
        return r15351;
}

double f_od(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        double r15352 = a;
        double r15353 = c;
        double r15354 = atan2(r15352, r15353);
        double r15355 = atan2(r15354, r15352);
        double r15356 = sqrt(r15355);
        double r15357 = r15356 * r15356;
        double r15358 = log(r15352);
        double r15359 = r15357 - r15358;
        return r15359;
}

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 r15360, r15361, r15362, r15363, r15364, r15365;

void setup_mpfr_f_im() {
        mpfr_set_default_prec(144);
        mpfr_init(r15360);
        mpfr_init(r15361);
        mpfr_init(r15362);
        mpfr_init(r15363);
        mpfr_init(r15364);
        mpfr_init(r15365);
}

double f_im(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        mpfr_set_d(r15360, a, MPFR_RNDN);
        mpfr_set_d(r15361, c, MPFR_RNDN);
        mpfr_atan2(r15362, r15360, r15361, MPFR_RNDN);
        mpfr_atan2(r15363, r15362, r15360, MPFR_RNDN);
        mpfr_log(r15364, r15360, MPFR_RNDN);
        mpfr_sub(r15365, r15363, r15364, MPFR_RNDN);
        return mpfr_get_d(r15365, MPFR_RNDN);
}

static mpfr_t r15366, r15367, r15368, r15369, r15370, r15371, r15372, r15373;

void setup_mpfr_f_fm() {
        mpfr_set_default_prec(144);
        mpfr_init(r15366);
        mpfr_init(r15367);
        mpfr_init(r15368);
        mpfr_init(r15369);
        mpfr_init(r15370);
        mpfr_init(r15371);
        mpfr_init(r15372);
        mpfr_init(r15373);
}

double f_fm(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        mpfr_set_d(r15366, a, MPFR_RNDN);
        mpfr_set_d(r15367, c, MPFR_RNDN);
        mpfr_atan2(r15368, r15366, r15367, MPFR_RNDN);
        mpfr_atan2(r15369, r15368, r15366, MPFR_RNDN);
        mpfr_sqrt(r15370, r15369, MPFR_RNDN);
        mpfr_sqr(r15371, r15370, MPFR_RNDN);
        mpfr_log(r15372, r15366, MPFR_RNDN);
        mpfr_sub(r15373, r15371, r15372, MPFR_RNDN);
        return mpfr_get_d(r15373, MPFR_RNDN);
}

static mpfr_t r15374, r15375, r15376, r15377, r15378, r15379, r15380, r15381;

void setup_mpfr_f_dm() {
        mpfr_set_default_prec(144);
        mpfr_init(r15374);
        mpfr_init(r15375);
        mpfr_init(r15376);
        mpfr_init(r15377);
        mpfr_init(r15378);
        mpfr_init(r15379);
        mpfr_init(r15380);
        mpfr_init(r15381);
}

double f_dm(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        mpfr_set_d(r15374, a, MPFR_RNDN);
        mpfr_set_d(r15375, c, MPFR_RNDN);
        mpfr_atan2(r15376, r15374, r15375, MPFR_RNDN);
        mpfr_atan2(r15377, r15376, r15374, MPFR_RNDN);
        mpfr_sqrt(r15378, r15377, MPFR_RNDN);
        mpfr_sqr(r15379, r15378, MPFR_RNDN);
        mpfr_log(r15380, r15374, MPFR_RNDN);
        mpfr_sub(r15381, r15379, r15380, MPFR_RNDN);
        return mpfr_get_d(r15381, MPFR_RNDN);
}

