Sorting a programs instructions until it works Lets say I have a computer program below.

(define (factorial x)
   (if (= x 0)
       1
       (else (* x (factorial (- x 1)))))


I then take each line of the program and create a random permutation.

       1
   (if (= x 0)
       (else (* x (factorial (- x 1)))))
(define (factorial x)


Now I give you a set of valid values that the program must return.
    1,2,6,24

Your task is to sort the permutations of the program until it gives you the result.

Is this a new problem? I haven't found anything remotely like the problem I proposed above. 

What is the runtime to solving this problem?
This can be done by running all the $n!$ permutations in parallel and wait for one of them to output $1,2,6,24$ on inputs $1,2,3,4$.

(Of course, that does not guarantee that you found the correct permutation for input 5.)

Specific running time estimates may depend on the programming language being used. For instance, in BASIC each line is supposed to start with a line number which makes this solvable in polynomial time.