I understand that any language worth its salt can encode a Finite state machine. My question is the opposite, is it possible to convert an arbitrary piece of code ( say in C ) to a functionally equivalent Finite State Machine ? for example if I have a piece of code with a couple of llvm basic blocks (loops, branches etc), can I replace all of them with a giant state machine, which essentially does the same ? 
Can a generic piece of C code be converted to an FSM?
programming languages;language design;finite state machine
Yes, of course it can.See Bohm & Jacopini's 1966 paper (Yes, fifty years ago), Flow diagrams, turing machines and languages with only two formation rules for the gory details.They showed that any program, even a mess of GOTO-spaghetti, can be converted into a WHILE-loop around a CASE statement, that together implement a finite-state machine.This was a critical result on the road to Structured Programming.  It proved, among other things, that GOTO statements were not necessary.