Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- printf_format:
- .string "%lf\n"
- .text
- .global myexpm2
- // *r - 20
- // x - 16, 12
- myexpm2:
- // стандартный пролог
- pushl %ebp // 4
- pushl %ebx // 0
- movl %esp, %ebp
- movl 16(%ebp), %eax
- pushl %eax
- movl 12(%ebp), %eax
- pushl %eax
- movsd (%esp), %xmm6
- mulsd %xmm6, %xmm6
- movl $0, %ebx
- cvtsi2sd %ebx, %xmm0
- subsd %xmm6, %xmm0 // -x^2 = %xmm0
- movl $1, %ebx
- cvtsi2sd %ebx, %xmm5 // слагаемое
- cvtsi2sd %ebx, %xmm3 // ans в %xmm3
- cvtsi2sd %ebx, %xmm4
- cycle:
- movsd %xmm4, %xmm3 // curr в %xmm4
- cvtsi2sd %ebx, %xmm2
- mulsd %xmm0, %xmm5
- divsd %xmm2, %xmm5
- addsd %xmm5, %xmm4
- addl $1, %ebx
- comisd %xmm4, %xmm3
- jnz cycle
- // возвращаем значение
- movl 20(%ebp), %eax
- movsd %xmm4, (%eax)
- ep: // стандартный эпилог
- movl %ebp, %esp
- popl %ebx
- popl %ebp
- ret
- //sub $8, %esp
- //movsd %xmm5, (%esp)
- //pushl $printf_format
- //call printf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement