ir generation for variables mostly working