Output report:
In all three cases the program takes an input array that is: 5 9 1 2 3
In cases 1 and 3 the array is sorted in the ascending order with an output being: 1 2 3 5 9
Whereas in case 2 the array is sorted in the descending order with an output being: 9 5 3 2 1

That is due to the fact L1, L2 and L3 are not compiled with the same libraries. 


 
When compiling L1 and L2 the -c option says not to run the linker to just produce object files as output from the C files l1.c and l2.c which are then linked to the object file created by compiling T3.c in the second gcc command. 
In L1 and L2 the produced object files are linked to two different libraries which causes the array to be sorted in different orders.
In L3 there is no linking, all the c files, including the one that was used to create the library libmylib1.a are given to the compiler which produces an executable. So the same sorting function is applied at the end in L1 and L3 even though the compilation process isn't exactly the same (with and without creating and linking a library) that's why their outputs are identical.
The library mylib1 from l1.c sorts in the ascending order and mylib2 from l2.c sorts in the descending order.



Starting libraries name with "lib" is a naming convention, this part of the name can then be dropped at the linking phase indicated when specifing the folder in which to look in for the library with -L and the library's name with -l<library name>.