I am learning assembly and compiled my some of my C code to assembly to see what it's doing. I had this piece of code which was ignoring whitespaces in my string.
while ((str[index] == ' ') || (str[index] == '\n') || (str[index] == '\t')
|| (str[index] == '\f') || (str[index] == '\r') || (str[index] == '\v'))
index++;
In normal compilation, assembly compares every one of these characters and I understand that. But if I compile with -O for optimised version, I get a much neater version but I'm not really sure what it's doing.
LBB0_12: ## in Loop: Header=BB0_1 Depth=1
incq %rax
LBB0_1: ## =>This Inner Loop Header: Depth=1
movzbl (%rdi,%rax), %ecx
leal -9(%rcx), %edx
cmpb $5, %dl
jb LBB0_12
## %bb.2: ## in Loop: Header=BB0_1 Depth=1
cmpb $32, %cl
je LBB0_12
I get that 32 is checking for space. But all other characters seem to be included in label 1 and there I get lost. Could someone please explain this? Thank you so much in advance!