1  .text
2  .globl mystery
3  .type mystery, @function
4  mystery:
5  movq %rdi, %rax
6  movq %rdi, %rdx
7  cmpb $0, (%rdi)
8  je .L5
9  .L3:
10 addq $1, %rdx
11 cmpb $0, (%rdx)
12 jne .L3
13 .L5:
14 addq $1, %rsi
15 movb -1(%rsi), %cl
16 addq $1, %rdx
17 movb %cl, -1(%rdx)
18 cmpb $0, %cl
19 jne .L5
20 ret
I am really confused about this one. Is it an implementation of strcpy or strcat. Also, I understand that the first loop searches for the null terminator of the string, and the second loop does the same but also makes a copy of the string, but I am having a hard time wrapping my head around what the entire function is doing. Is it copying string stored at %rdi to another location (strcpy) or is it adding string stored at %rsi to the end of %rdi (strcat).
 
    