$\require{cancel}$
TopOfLoop1:
test eax, eax,
jz .done
...
jmp TopOfLoop1
.done
TopOfLoop2:
test eax, eax,
jz .done
...
jmp TopOfLoop2
.done
jmp label
label the next instruction to be executed.
pushf, pushfd, pushfq to move the flags to the stack.
sahf to save the bottom 8 bits to the ah register.
cmp instruction
loop instruction.
; rcx is the LCV
;set rcx to be positive
LABEL:
; loop body code
loop LABEL
; rcx is the LCV
;set rcx to be positive
LABEL:
; loop body code
dec rcx
cmp rcx, 0
jne LABEL
loop code.