// Benchmark function — orBug-style recursive double expression eval.
// Used to compare W65816 backend (with W65816ImgCalleeSave pass) vs Calypsi.
double evalAt(char **p, int prec) {
    double a = 0.0;
    while (**p >= '0' && **p <= '9') {
        a = a * 10.0 + (double)(**p - '0');
        (*p)++;
    }
    while (1) {
        int op = **p;
        int oprec;
        if (op == '*' || op == '/') oprec = 4;
        else if (op == '+' || op == '-') oprec = 3;
        else return a;
        if (oprec <= prec) return a;
        (*p)++;
        double b = evalAt(p, oprec);
        if (op == '+') a = a + b;
        else if (op == '*') a = a * b;
    }
}
