This happens because the assignment statement tries to access the location of x by visiting the identifier node, which assigns to tmp_v rather than tmp_p in cast of argument (from args_table)
One way to solve this would be to make args_table return pointers instead of values (like ptrs_table), but this would require modifications in RoutineDeclarations.
We may actually use only one table (ptrs_table) and remove (args_table)
Code to reproduce
Expected behavior
Prints 2
Actual behavior
Notes
tmp_v
rather thantmp_p
in cast of argument (from args_table)