public IReadOnlyList <IFunction> Parse(IAssemblyInstructionForTransformation firstAssemblyInstruction,
                                               AddressesRange addressesRangePermittedForParsing, Dictionary <ulong, ulong> jumpTargetAddresses)
        {
            if (firstAssemblyInstruction == null)
            {
                throw new ArgumentNullException("firstAssemblyInstruction");
            }

            List <IFunction> functionsList = new List <IFunction>();
            var instruction = firstAssemblyInstruction;

            while (instruction != null && instruction.Offset <= addressesRangePermittedForParsing.EndAddress)
            {
                var prologInstruction = PrologParser.Parse(instruction, addressesRangePermittedForParsing.EndAddress);
                if (prologInstruction == null)
                {
                    break;
                }

                var epilogInstruction = EpilogParser.Parse(prologInstruction, addressesRangePermittedForParsing.EndAddress);
                if (epilogInstruction == null)
                {
                    break;
                }

                IReadOnlyList <IBasicBlock> basicBlocks = BasicBlockParser.Parse(prologInstruction,
                                                                                 epilogInstruction, jumpTargetAddresses);
                functionsList.Add(FunctionFactory.Create(prologInstruction, epilogInstruction, basicBlocks));

                //set instruction to the instruction after the epilog instruction
                instruction = epilogInstruction.NextInstruction;
            }

            return(functionsList);
        }
        private IReadOnlyList <IFunction> parseFunctions(
            IInstructionWithAddressOperandDecider instructionWithAddressOperandDecider,
            IReadOnlyList <IAssemblyInstructionForTransformation> listOfInstructions)
        {
            AddressesRange addressesRange      = new AddressesRange(listOfInstructions[0].Offset, listOfInstructions.Last().Offset);
            var            jumpTargetAddresses = GetJumpTargetAddresses(instructionWithAddressOperandDecider,
                                                                        listOfInstructions);

            return(m_functionParser.Parse(listOfInstructions[0], addressesRange, jumpTargetAddresses));
        }