.global calc_word_lengths calc_word_lengths: // rdi has the string to analyze // rsi has the result string next_word: mov $0, %dl next_character: inc %dl inc %rdi cmpb $0, (%rdi) je done cmpb $' ', (%rdi) jne next_character add $'0', %dl movb %dl, (%rsi) inc %rsi movb $',', (%rsi) inc %rsi inc %rdi jmp next_word done: add $'0', %dl movb %dl, (%rsi) inc %rsi movb $0, (%rsi) ret