#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 r15509 = a;
        float r15510 = c;
        float r15511 = atan2(r15509, r15510);
        float r15512 = atan2(r15511, r15509);
        float r15513 = log(r15509);
        float r15514 = r15512 - r15513;
        return r15514;
}

double f_id(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        double r15515 = a;
        double r15516 = c;
        double r15517 = atan2(r15515, r15516);
        double r15518 = atan2(r15517, r15515);
        double r15519 = log(r15515);
        double r15520 = r15518 - r15519;
        return r15520;
}


double f_of(float a, float __attribute__((unused)) b, float c, float __attribute__((unused)) d) {
        float r15521 = a;
        float r15522 = c;
        float r15523 = atan2(r15521, r15522);
        float r15524 = atan2(r15523, r15521);
        float r15525 = sqrt(r15524);
        float r15526 = r15525 * r15525;
        float r15527 = log(r15521);
        float r15528 = r15526 - r15527;
        return r15528;
}

double f_od(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        double r15529 = a;
        double r15530 = c;
        double r15531 = atan2(r15529, r15530);
        double r15532 = atan2(r15531, r15529);
        double r15533 = sqrt(r15532);
        double r15534 = r15533 * r15533;
        double r15535 = log(r15529);
        double r15536 = r15534 - r15535;
        return r15536;
}

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 r15537, r15538, r15539, r15540, r15541, r15542;

void setup_mpfr_f_im() {
        mpfr_set_default_prec(144);
        mpfr_init(r15537);
        mpfr_init(r15538);
        mpfr_init(r15539);
        mpfr_init(r15540);
        mpfr_init(r15541);
        mpfr_init(r15542);
}

double f_im(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        mpfr_set_d(r15537, a, MPFR_RNDN);
        mpfr_set_d(r15538, c, MPFR_RNDN);
        mpfr_atan2(r15539, r15537, r15538, MPFR_RNDN);
        mpfr_atan2(r15540, r15539, r15537, MPFR_RNDN);
        mpfr_log(r15541, r15537, MPFR_RNDN);
        mpfr_sub(r15542, r15540, r15541, MPFR_RNDN);
        return mpfr_get_d(r15542, MPFR_RNDN);
}

static mpfr_t r15543, r15544, r15545, r15546, r15547, r15548, r15549, r15550;

void setup_mpfr_f_fm() {
        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);
        mpfr_init(r15550);
}

double f_fm(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        mpfr_set_d(r15543, a, MPFR_RNDN);
        mpfr_set_d(r15544, c, MPFR_RNDN);
        mpfr_atan2(r15545, r15543, r15544, MPFR_RNDN);
        mpfr_atan2(r15546, r15545, r15543, MPFR_RNDN);
        mpfr_sqrt(r15547, r15546, MPFR_RNDN);
        mpfr_sqr(r15548, r15547, MPFR_RNDN);
        mpfr_log(r15549, r15543, MPFR_RNDN);
        mpfr_sub(r15550, r15548, r15549, MPFR_RNDN);
        return mpfr_get_d(r15550, MPFR_RNDN);
}

static mpfr_t r15551, r15552, r15553, r15554, r15555, r15556, r15557, r15558;

void setup_mpfr_f_dm() {
        mpfr_set_default_prec(144);
        mpfr_init(r15551);
        mpfr_init(r15552);
        mpfr_init(r15553);
        mpfr_init(r15554);
        mpfr_init(r15555);
        mpfr_init(r15556);
        mpfr_init(r15557);
        mpfr_init(r15558);
}

double f_dm(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        mpfr_set_d(r15551, a, MPFR_RNDN);
        mpfr_set_d(r15552, c, MPFR_RNDN);
        mpfr_atan2(r15553, r15551, r15552, MPFR_RNDN);
        mpfr_atan2(r15554, r15553, r15551, MPFR_RNDN);
        mpfr_sqrt(r15555, r15554, MPFR_RNDN);
        mpfr_sqr(r15556, r15555, MPFR_RNDN);
        mpfr_log(r15557, r15551, MPFR_RNDN);
        mpfr_sub(r15558, r15556, r15557, MPFR_RNDN);
        return mpfr_get_d(r15558, MPFR_RNDN);
}

