clc
clear

function y = mySuperHorner(p, x0)
    c = coeff(p);
    n = degree(p) + 1;
    y(1) = c(n);
    y(2) = y(1)
    for i = n-1:-1:1
        y(1) = y(1)*x0 + c(i);
        y(2) = y(2)*x0 + y(1);
    end
    y(2) = y(2) - y(1)
endfunction

p = poly([1 4 -2 3], "x", "coeff");

mprintf("The answer is %d\n", mySuperHorner(p, 1))
