1. A method for generating a main program code to be executed by a main processing unit, and an auxiliary program code to be executed by an auxiliary processing unit for checking a control flow of the main program code, the method comprising: generating the main program code comprises generating at least one main indirect branch instruction; generating the auxiliary program code comprises generating at least one auxiliary indirect branch instruction associated with the at least one main indirect branch instruction; and generating the main program code further comprises inserting synchronization data to be processed by the auxiliary processing unit and configured to allow at least one synchronization between an auxiliary program code part and a main program code part resulting, respectively, from execution of the at least one auxiliary indirect branch instruction and from the execution of the at least one main indirect branch instruction, wherein: the at least one main indirect branch instruction comprises at least one main indirect jump instruction incorporated in a function of the main program code comprising a main return instruction; the at least one auxiliary indirect branch instruction comprises at least one auxiliary indirect jump instruction incorporated in a function of the auxiliary program code comprising an auxiliary return instruction; at least one auxiliary branch resulting from the execution of the at least one auxiliary indirect jump instruction and at least one main branch resulting from the execution of the at least one main indirect jump instruction are non-predictable; and the synchronization data to be processed by the auxiliary processing unit is configured to allow at least one synchronization between the at least one main return instruction and the at least one auxiliary return instruction.