I've been following this tutorial but I got stuck. He starts explaining at about 6:30.
So there is a for loop in that episode that looks like this. And I got lost during the explanation as he said. But I rewatched it a couple of times and there is one thing I don't understand. So this is the code and I took some notes while watching the registers.
mov rax, [rbp+arg]
So after this line rax = 0x7ffe63c2d498 and arg = 0x7ffe63c2d380 . I decoded these two but nothing comes up so I'm assuming they are pointers.
add rax, 8
mov rdx, [rax]
After this line rdx = 0x7ffe63c2e09d . I'm assuming this is a pointer again.
mov eax, [rbp+i]
This moves the value of i in eax for example 0x01
cdqe
add rax, rdx
Here you add the value of i to the pointer of the string.
movzx eax, byte ptr [rax]
Here you move the character that the rax was pointing to into eax.
movsx eax, al
add [rbp+sum], eax
add [rbp+i], 1
Here you sum up and i++.
My question is: aren't [] supposed to move the value that the address points to into the register? So it moves the value arg is pointing to into rax and then the value rax is pointing to into rdx. But both of these are pointers. How come? So arg is a pointer to a pointer to a pointer?