Legend of Debug just brings me back to this thread. Mentioning N64 and starting with Legend of the guess is presumably a version of the Zelda Ocarina of Time.
There are three ways ROMs get shrunk (assuming compressed ones are not supported by a flash cart or something)
1) Trimming. Basic ROMs for many things will be some power of 2 size, some games on more involved systems (see bank switching) however will be other things making this harder to do much with. Anyway as the power of 2 is the size of the storage chip and not necessarily every byte gets used you can often lose the excess and gain something back. Minimal of this for the N64 but a possibility.
2) Very annoying methods. You can shuffle things around to turn it into a smaller file or use blank space within the ROM, however you have to find the space (presumably from the end or enough to delete a bank and change for a smaller one). Every pointer referencing the data you want to move will need to be changed, including every calculation that derives such a thing. It is not impossible but it is very tedious.
3) ROM ripping (yes the term is confusing). This only really applies to file system based things (is it a floppy disc, optical media or DS or later? If so maybe, if not then back to 2) wherein you can unpack the ROM and fiddle with contents.
Latterly with the N64 seeing decompilations, OOT very much being one of those, you could also rejig the files being used to make that up to possibly leave some out, or order them differently, or maybe compress them, or reduce quality...
I would also not be surprised to find this is how patches were done (editing C code is far easier than editing a compiled binary with the weird MIPS assembly the N64 uses) which further complicates some of the above methods if they were viable as a base thing.