Non-Volatile Memories (NVMs), such as Phase Change Memories (PCMs) and Resistive RAMs (ReRAMs), have been recently proposed as a main memory due to their higher capacity and low leakage power consumption compared to traditional DRAMs. In order to support the NVM-based systems, many software platforms are developed and they provide user-level programming interfaces. However, many existing applications are already written based on the conventional DRAM-based systems; thus, programmers have to rewrite or modify the code in order for the code to successfully run on NVM-based systems. In order to solve this problem, we introduce a code-conversion tool named a Code Regenerator that transforms applications that are originally designed for conventional operating systems using DRAM as a main memory into applications that runs on HEAPO which is a non-volatile memory based software platform. The code regenerator consists of code profiler and code generator. Among all dynamic and static memory objects of an application, code profiler profiles the code to find the objects that fit well into the characteristics of NVM. Based on the profiling result, code generator re-writes the target application code to exploit NVM through HEAPO programming interfaces based on the profiling result. In this paper, we demonstrate that applications transformed through code regenerator stably run on NVM platform without manual code modification. By allocating read-intensive memory objects to NVM, the regenerated applications reduce the energy consumption by up to 44% compared to that of the original applications.