implemented alternative top_level_scopes
porting mem2reg to new top_level_scopes
fixed warning: unused variable