foo(something *rdi) { int? rax = -1; here: something tmp = (memory[1 + rdi + rax] != 0); rax = rax + 1; if (tmp) goto here; return rax; } strlen(char *rdi) { long rax = -1; do { char tmp = (memory[1 + rdi + rax] != 0); rax = rax + 1; } while (tmp); return rax; } foo("\0") -> 0 foo("") -> ??? 1 or 0 or crash or infinite loop foo("h") -> 1 foo("hello") -> 5 "hi" -> {'h', 'i', '\0'} movq $-1, %rax %rax is a "register" rax = -1 here: cmpb $0, 1(%rdi,%rax) is 0 < memory[1 + rdi + rax] because rdi is new, it's probably a parameter of function rdi is probably a pointer leaq 1(%rax), %rax rax = 1 + rax jne 0x7 <foo+0x7> if last comparison was not ==, go to "here" retq (rax)