A code-size optimization
If you move the mov edi, Metrics
instruction to just below the FindMatch label and thus have it repeat with each iteration, you can remove 4 instructions from the code. I've marked these with an exclamation mark:
xor edx, edx mov ecx, edx FindMatch: mov edi, Metrics ;Restore it from here lodsq ! push rdi add edi, ecx add cl, 2! jmp .cmpstr + 1 ; No need to save RDI again .cmpstr:! push rdi push rsi ... .nextone: pop rsi! pop rdi ; Restore pointer to array of pointers. jmp FindMatch
cmp bl, 'L'jz .cmpstrcmp bl, 'C'
Are these environment strings guaranteed to be in uppercase?