.data string: .asciz "Test" .text .globl main main: pushl %ebp movl %esp, %ebp pushl %edi xorb %al, %al movl $-1, %ecx movl $string, %edi cld repne scasb not %ecx dec %ecx popl %edi ;; string length is stored in %ecx register leave ret