Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .global tree_find
- .text
- tolerance:
- .double 0.00000001
- printf_str:
- .asciz "%lf\n"
- tree_find:
- push %ebx
- push %ebp
- mov %esp, %ebp
- mov 24(%ebp), %edx
- movsd 16(%ebp), %xmm0
- movl 12(%ebp), %ebx
- rec:
- test %ebx, %ebx
- jz not_found
- movsd (%ebx), %xmm1
- addsd tolerance, %xmm1
- comisd %xmm1, %xmm0
- ja right
- subsd tolerance, %xmm1
- subsd tolerance, %xmm1
- comisd %xmm0, %xmm1
- ja left
- test %edx, %edx // 24(%ebp)
- jz not_found
- mov 16(%ebx), %eax
- mov %eax, (%edx)
- mov $1, %eax
- jmp epilogue
- left:
- movl 8(%ebx), %ebx
- jmp rec
- right:
- movl 12(%ebx), %ebx
- jmp rec
- not_found:
- mov $0, %eax
- epilogue:
- mov %ebp, %esp
- pop %ebp
- pop %ebx
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement