Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .text
- .global mul64p
- mul64p: // (a(12), b(8)) * (c(20), d(16))
- pushl %ebp
- movl %esp, %ebp
- xorl %eax, %eax
- subl $16, %esp
- movl $0, (%esp)
- movl $0, 4(%esp)
- movl $0, 8(%esp)
- movl $0, 12(%esp)
- // d * b
- movl 8(%ebp), %eax
- mull 16(%ebp)
- movl %eax, (%esp)
- movl %edx, 4(%esp)
- // a * d
- movl 12(%ebp), %eax
- mull 16(%ebp)
- addl %eax, 4(%esp)
- adcl %edx, 8(%esp)
- adcl $0, 12(%esp)
- // c * b
- movl 8(%ebp), %eax
- mull 20(%ebp)
- addl %eax, 4(%esp)
- adcl %edx, 8(%esp)
- adcl $0, 12(%esp)
- // a * c
- movl 12(%ebp), %eax
- mull 20(%ebp)
- addl %eax, 8(%esp)
- adcl %edx, 12(%esp)
- // write number
- // first
- xorl %ebx, %ebx
- movl 12(%esp), %eax
- testl %eax, %eax
- jz f2
- movl $1, %ebx
- pushl %eax
- pushl $fout
- call printf
- addl $8, %esp
- jmp n2
- f2: movl 8(%esp), %eax
- testl %eax, %eax
- jz f3
- pushl %eax
- pushl $fout
- call printf
- addl $8, %esp
- jmp n3
- f3: movl 4(%esp), %eax
- testl %eax, %eax
- jz f4
- pushl %eax
- pushl $fout
- call printf
- addl $8, %esp
- jmp n4
- f4: pushl $fout
- call printf
- addl $4, %esp
- jmp end
- n2: movl 8(%esp), %eax
- pushl %eax
- pushl $nout
- call printf
- addl $8, %esp
- n3: movl 4(%esp), %eax
- pushl %eax
- pushl $nout
- call printf
- addl $8, %esp
- n4: pushl $nout
- call printf
- addl $4, %esp
- end: pushl $nl
- call printf
- addl $20, %esp
- popl %ebp
- ret
- .data
- zero: .quad 0x0
- fout: .asciz "%x"
- nout: .asciz "%08x"
- nl: .asciz "\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement