; Build/ekkie_dict.asm · EKKIE over dictionary hashes
; edi = djb2 word hash → eax = index|1 or 0 if miss
bits 64
default rel
extern dict_count, dict_hashes
global ekkie_dict_lookup
section .text
ekkie_dict_lookup:
        push    rbx
        push    r12
        mov     r12d, edi
        mov     eax, [rel dict_count]
        xor     ebx, ebx
.loop:
        cmp     ebx, eax
        jge     .miss
        lea     rcx, [rel dict_hashes]
        mov     ecx, [rcx + rbx*4]
        cmp     ecx, r12d
        je      .hit
        inc     ebx
        jmp     .loop
.hit:
        mov     eax, ebx
        or      eax, 1
        pop     r12
        pop     rbx
        ret
.miss:
        xor     eax, eax
        pop     r12
        pop     rbx
        ret
