As I think I have already said - it scans through and finds all functions, makes prototypes, and add then just after the last #include (and before everything else).
Actually, to be more precise, it finds the first line in the file that doesn't start with a # (after stripping the comments) and places the prototypes before that line.
I think that's the wrong approach, really. It should identify the line on which the first function is defined (which it should be able to find while scanning through the file) and place all prototypes directly before that line - that way it will catch all structs, typedefs, etc that are defined at the top of the sketch. Won't help with any defined part-way through of course...