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