codegen while