%include "lib.inc"

section .text
global find_word

section .text

find_word:

.loop:
    push rdi
    push rsi
    add rsi, 8
    sub rsp, 8
    call string_equals
    add rsp, 8
    pop rsi
    pop rdi
    cmp rax, 1
    je .found
    mov rsi, [rsi]
    cmp rsi, 0
    je .not_found
    jmp .loop

.found:
    sub rsp, 8
    call string_length
    add rsp, 8
    add rax, rsi
    add rax, 9
    ret

.not_found:
    mov rax, 0
    ret