Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- count:
- .long 0
- pos:
- .long 0
- .text
- .type fun, @function
- .global fun
- #rdi - a
- #rsi - b
- #rdx - pcs
- #rcx - count
- fun:
- MOVB $0, %r10 #licznik petli
- CMPB $1, %rsi
- JE sum
- CMPB $2, %rsi
- JE mul
- loop2:
- JMP podst
- after_podst:
- CMPB $1, %rsi
- JE sum_op
- CMPB $2, %rsi
- JE mul_op
- after_op
- INC %r10
- CMPB $64, %r10
- JNE loop2
- CMPB $2, %rsi
- JE mul_op_2
- MOV %r9, %rsi
- RET
- MOV %rdi, %rbx
- sum:
- MOVB $0, %r9 #suma
- mul:
- MOV $1, %eax #mnozenie
- #mul_op:
- #MOV %r10, %r12
- #INC %r12
- #IMUL %r12
- sum_op:
- ADD (%rbx), %r9
- INC %rbx
- JMP after_op
- mul_op_2:
- MOV %eax, %r9
- not_zero_bit
- MOV count, %r11
- INC %r11
- MOV %r11, count
- MOV %r10, pos
- JMP after_podst
- podst:
- CMPB $1, (%rbx)
- JE not_zero_bit
- JMP after_podst
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement