Yesterday, we had a related question on this site:
A 64-bit number will be stored in two registers because a register has only 32 bits.
Mathematical background
You might imagine a computer that does not calculate in binary but in decimal (or BCD - as some computers in the 1960s did) and where a register can store 3 decimal digits.
In this case the number 123456 (decimal) would be stored as 123 (in one register) and 456 (in another register).
Unfortunately, different bases behave differently:
Decimal Hexadecimal
099 063
355 163
160 0A0
260 104
You can see that between the numbers 99 and 355 (decimal) there is only one digit difference in the hexadecimal system but all 3 digits are different in the decimal system.
For the numbers 160 and 260 (decimal) it is exactly the other way round.
This means: If we want to convert the number 123456 in the example above to hexadecimal, we cannot convert the numbers 123 and 456 to hexadecimal first, but we have to take the number 123456 as complete number before doing the conversion:
Decimal Hexadecimal
123 7B
456 1C8
123456 1E240 (does neither contain 7-B nor 1-C-8)
Exceptions to this rule are for example "binary<->octal" if the registers are a multiple of 3 bits wide or "binary<->hexadecimal" if the registers are a multiple of 4 bits wide or "octal<->hexadecimal" if the registers are a multiple of 12 bits (or 4 octal or 3 hexadecimal digits) wide:
Octal Hexadecimal
1234 29C
5670 BB8
12345670 29CBB8
This is why hexadecimal is so popular among low-level programmers!
Now back to your program
The values stored in MIPS registers are binary, not decimal. You are interested in printing out the whole 64-bit number as decimal.
So the problem is the same one as in the example with the decimal computer where we are interested in a hexadecimal result:
- The computer stores a value which is too large for one register in two registers
- We want to see the result in another base as the base the computer is working with
- First converting both registers separately will get us nowhere (see the example with 123456 -> 1E240) but we have to take the whole number and convert it
However, the numbers 266201827 and 768509613 are the two registers converted to decimal separately!