#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 r15473 = a;
        float r15474 = c;
        float r15475 = atan2(r15473, r15474);
        float r15476 = atan2(r15475, r15473);
        float r15477 = log(r15473);
        float r15478 = r15476 - r15477;
        return r15478;
}

double f_id(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        double r15479 = a;
        double r15480 = c;
        double r15481 = atan2(r15479, r15480);
        double r15482 = atan2(r15481, r15479);
        double r15483 = log(r15479);
        double r15484 = r15482 - r15483;
        return r15484;
}


double f_of(float a, float __attribute__((unused)) b, float c, float __attribute__((unused)) d) {
        float r15485 = a;
        float r15486 = c;
        float r15487 = atan2(r15485, r15486);
        float r15488 = atan2(r15487, r15485);
        float r15489 = exp(r15488);
        float r15490 = log(r15489);
        float r15491 = log(r15485);
        float r15492 = r15490 - r15491;
        return r15492;
}

double f_od(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        double r15493 = a;
        double r15494 = c;
        double r15495 = atan2(r15493, r15494);
        double r15496 = atan2(r15495, r15493);
        double r15497 = exp(r15496);
        double r15498 = log(r15497);
        double r15499 = log(r15493);
        double r15500 = r15498 - r15499;
        return r15500;
}

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 r15501, r15502, r15503, r15504, r15505, r15506;

void setup_mpfr_f_im() {
        mpfr_set_default_prec(144);
        mpfr_init(r15501);
        mpfr_init(r15502);
        mpfr_init(r15503);
        mpfr_init(r15504);
        mpfr_init(r15505);
        mpfr_init(r15506);
}

double f_im(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        mpfr_set_d(r15501, a, MPFR_RNDN);
        mpfr_set_d(r15502, c, MPFR_RNDN);
        mpfr_atan2(r15503, r15501, r15502, MPFR_RNDN);
        mpfr_atan2(r15504, r15503, r15501, MPFR_RNDN);
        mpfr_log(r15505, r15501, MPFR_RNDN);
        mpfr_sub(r15506, r15504, r15505, MPFR_RNDN);
        return mpfr_get_d(r15506, MPFR_RNDN);
}

static mpfr_t r15507, r15508, r15509, r15510, r15511, r15512, r15513, r15514;

void setup_mpfr_f_fm() {
        mpfr_set_default_prec(144);
        mpfr_init(r15507);
        mpfr_init(r15508);
        mpfr_init(r15509);
        mpfr_init(r15510);
        mpfr_init(r15511);
        mpfr_init(r15512);
        mpfr_init(r15513);
        mpfr_init(r15514);
}

double f_fm(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        mpfr_set_d(r15507, a, MPFR_RNDN);
        mpfr_set_d(r15508, c, MPFR_RNDN);
        mpfr_atan2(r15509, r15507, r15508, MPFR_RNDN);
        mpfr_atan2(r15510, r15509, r15507, MPFR_RNDN);
        mpfr_exp(r15511, r15510, MPFR_RNDN);
        mpfr_log(r15512, r15511, MPFR_RNDN);
        mpfr_log(r15513, r15507, MPFR_RNDN);
        mpfr_sub(r15514, r15512, r15513, MPFR_RNDN);
        return mpfr_get_d(r15514, MPFR_RNDN);
}

static mpfr_t r15515, r15516, r15517, r15518, r15519, r15520, r15521, r15522;

void setup_mpfr_f_dm() {
        mpfr_set_default_prec(144);
        mpfr_init(r15515);
        mpfr_init(r15516);
        mpfr_init(r15517);
        mpfr_init(r15518);
        mpfr_init(r15519);
        mpfr_init(r15520);
        mpfr_init(r15521);
        mpfr_init(r15522);
}

double f_dm(double a, double __attribute__((unused)) b, double c, double __attribute__((unused)) d) {
        mpfr_set_d(r15515, a, MPFR_RNDN);
        mpfr_set_d(r15516, c, MPFR_RNDN);
        mpfr_atan2(r15517, r15515, r15516, MPFR_RNDN);
        mpfr_atan2(r15518, r15517, r15515, MPFR_RNDN);
        mpfr_exp(r15519, r15518, MPFR_RNDN);
        mpfr_log(r15520, r15519, MPFR_RNDN);
        mpfr_log(r15521, r15515, MPFR_RNDN);
        mpfr_sub(r15522, r15520, r15521, MPFR_RNDN);
        return mpfr_get_d(r15522, MPFR_RNDN);
}

