-.loop:
- movzx rcx, byte [rsi + 8] ; Length of word being looked at
- cmp rcx, [.search_length]
- jne .next ; If the words don't have the same length, we have the wrong word
-
- ;; Otherwise, we need to compare strings
- lea rdx, [rsi + 8 + 1] ; Location of character being compared in entry
- mov rdi, [.search_buffer] ; Location of character being compared in search buffer
-.compare_char:
- mov al, [rdx]
- mov ah, [rdi]
- cmp al, ah
- jne .next ; They don't match; try again
- inc rdx ; These characters match; look at the next ones
- inc rdi
- loop .compare_char
-
- jmp .found ; They match! We are done.
-
-.next:
- mov rsi, [rsi] ; Look at the previous entry
- cmp rsi, 0
- jnz .loop ; If there is no previous word, exit and return 0
-
-.found: