correctly detect how many local variables a subroutine has and declare it