How to deal with phi-nodes

Hi, LLVMers.

I am trying to restore the original HL code from LLVM IR (kinda reverse engineering).
However, I have no good idea about how to handle PHI nodes. It is quite tricky for me to deal with the PHI nodes in LLVM IR in order to restore the original-like code. I read some reverse engineering thesis but they are a little bit old so don't handle SSA form.

Could you shed some lights on me how I can give it a shot?
It also should be greatly appreciated if you can introduce some references about that.


Dear Seung Jae Lee,

     I believe, and the others may correct me if I am mistaken, that LLVM does not keep information necessary to return to pre-SSA-form. Actually, some optimizations, like constant folding, end up deleting some copies, and the SSA-form used in LLVM may contain variables in the same phi-function that interfere.
      If you want to convert the program into a format in which no variable in the same phi-function interfere, I have a pass to do that. Once that is done, you can simply replace all the variables related by phi-functions with a single name, which, of course, could be defined many times.