3 .type mul_digits, @function
7 # Multiply an array of 64 bit digits by *one* 64 bit digit, modifies the array in place
9 movq %rdx, %rcx # rdx is reserved for mulq, use rcx as counter
10 movq $0, %r12 # Overflow register
12 movq %rsi, %rax # Value to multiply in %rax
13 mulq (%rdi) # Multiply, stored in %rdx:%rax (ie: we get TWO digits)
15 # Add overflow from previous operation
17 # Upper digit gets saved as next overflow
20 # Lower digit goes in current array position
23 dec %rcx # Decrement counter
24 jz end_loop # We are done
26 # Move to next element in the array
32 movq %r12, %rax # Return overflow