As the Standard Library headers are independent of each other, it makes sense to include them in consistent order - alphabetical is a good choice.
The main() function here is very long - more than a screenful. That's usually a sign that it should be split into functions for the different responsibilities. In particular, the file reading seems worthy of its ...
In FindCompress and Union the parameters N, i and j could be passed as const as they are not changed in the functions.
Avoid using keywords as function names.
In C union is a keyword, even though the function name is currently in CamelCase I would still recommend against it.
Segment struct definition
typedef struct Segment Segment;