Break up the huge main() function
I will give my best to be available this weekend but the review takes time until the patch is in an acceptable state, same for the other revision.
This process is required to keep good quality and catch bugs, even subtile ones early. Breaking code is the worst of all options.
Such a long list of returned values make me wonder if it would be worth creating a NamedTuple / class to hold them.
These three check_* function all use the same 'FileCheck', '-....'] pattern. Maybe it's worth syndicating that to a try_run_filecheck(input_file0, input_file1, *extra_args)` function.
This is the verbose call site I was pointing to above.