Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <string.h>
int main(void){
    char sa[101], sb[101], sc[101], drop, winner;
    scanf("%s%s%s", sa, sb, sc);
    for(int count=0;; count++){
        if(count==0||drop=='a'){
            winner='A';
            if(sa[0]=='\0') break;
            drop=sa[0];
            strcpy(sa, sa+1);
        }
        else if(drop=='b'){
            winner='B';
            if(sb[0]=='\0') break;
            drop=sb[0];
            strcpy(sb, sb+1);
        }
        else if(drop=='c'){
            winner='C';
            if(sc[0]=='\0') break;
            drop=sc[0];
            strcpy(sc, sc+1);
        }
    }
    printf("%c", winner);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s%s%s"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$352, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-112(%rbp), %rcx
	leaq	-224(%rbp), %rdx
	leaq	-336(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -340(%rbp)
.L10:
	cmpl	$0, -340(%rbp)
	je	.L2
	cmpb	$97, -342(%rbp)
	jne	.L3
.L2:
	movb	$65, -341(%rbp)
	movzbl	-336(%rbp), %eax
	testb	%al, %al
	je	.L13
	movzbl	-336(%rbp), %eax
	movb	%al, -342(%rbp)
	leaq	-336(%rbp), %rax
	addq	$1, %rax
	leaq	-336(%rbp), %rdx
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcpy@PLT
	jmp	.L6
.L3:
	cmpb	$98, -342(%rbp)
	jne	.L7
	movb	$66, -341(%rbp)
	movzbl	-224(%rbp), %eax
	testb	%al, %al
	je	.L14
	movzbl	-224(%rbp), %eax
	movb	%al, -342(%rbp)
	leaq	-224(%rbp), %rax
	addq	$1, %rax
	leaq	-224(%rbp), %rdx
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcpy@PLT
	jmp	.L6
.L7:
	cmpb	$99, -342(%rbp)
	jne	.L6
	movb	$67, -341(%rbp)
	movzbl	-112(%rbp), %eax
	testb	%al, %al
	je	.L15
	movzbl	-112(%rbp), %eax
	movb	%al, -342(%rbp)
	leaq	-112(%rbp), %rax
	addq	$1, %rax
	leaq	-112(%rbp), %rdx
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcpy@PLT
.L6:
	addl	$1, -340(%rbp)
	jmp	.L10
.L13:
	nop
	jmp	.L5
.L14:
	nop
	jmp	.L5
.L15:
	nop
.L5:
	movsbl	-341(%rbp), %eax
	movl	%eax, %edi
	call	putchar@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s%s%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$344, %rsp
	.cfi_def_cfa_offset 400
	movq	%fs:40, %rax
	movq	%rax, 328(%rsp)
	xorl	%eax, %eax
	leaq	112(%rsp), %r14
	movq	%rsp, %r12
	leaq	1(%rsp), %r13
	leaq	224(%rsp), %r15
	movq	%r14, %rdx
	movq	%r12, %rsi
	movq	%r15, %rcx
	call	__isoc99_scanf@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L2:
	cmpb	$98, %bl
	je	.L15
	cmpb	$99, %bl
	je	.L16
.L5:
	addl	$1, %ebp
.L7:
	testl	%ebp, %ebp
	je	.L12
	cmpb	$97, %bl
	jne	.L2
.L12:
	movzbl	(%rsp), %ebx
	testb	%bl, %bl
	je	.L9
	movl	$101, %edx
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__strcpy_chk@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L15:
	movzbl	112(%rsp), %ebx
	testb	%bl, %bl
	je	.L10
	leaq	113(%rsp), %rsi
	movl	$101, %edx
	movq	%r14, %rdi
	call	__strcpy_chk@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L16:
	movzbl	224(%rsp), %ebx
	testb	%bl, %bl
	je	.L11
	leaq	225(%rsp), %rsi
	movl	$101, %edx
	movq	%r15, %rdi
	call	__strcpy_chk@PLT
	jmp	.L5
.L9:
	movl	$65, %edi
.L4:
	call	putchar@PLT
	movq	328(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$344, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	movl	$66, %edi
	jmp	.L4
.L11:
	movl	$67, %edi
	jmp	.L4
.L17:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s%s%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$344, %rsp
	.cfi_def_cfa_offset 400
	movq	%fs:40, %rax
	movq	%rax, 328(%rsp)
	xorl	%eax, %eax
	leaq	112(%rsp), %r14
	movq	%rsp, %r12
	leaq	1(%rsp), %r13
	leaq	224(%rsp), %r15
	movq	%r14, %rdx
	movq	%r12, %rsi
	movq	%r15, %rcx
	call	__isoc99_scanf@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L2:
	cmpb	$98, %bl
	je	.L15
	cmpb	$99, %bl
	je	.L16
.L5:
	addl	$1, %ebp
.L7:
	testl	%ebp, %ebp
	je	.L12
	cmpb	$97, %bl
	jne	.L2
.L12:
	movzbl	(%rsp), %ebx
	testb	%bl, %bl
	je	.L9
	movl	$101, %edx
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__strcpy_chk@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L15:
	movzbl	112(%rsp), %ebx
	testb	%bl, %bl
	je	.L10
	leaq	113(%rsp), %rsi
	movl	$101, %edx
	movq	%r14, %rdi
	call	__strcpy_chk@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L16:
	movzbl	224(%rsp), %ebx
	testb	%bl, %bl
	je	.L11
	leaq	225(%rsp), %rsi
	movl	$101, %edx
	movq	%r15, %rdi
	call	__strcpy_chk@PLT
	jmp	.L5
.L9:
	movl	$65, %edi
.L4:
	call	putchar@PLT
	movq	328(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$344, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	movl	$66, %edi
	jmp	.L4
.L11:
	movl	$67, %edi
	jmp	.L4
.L17:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>
#include <string.h>
int main(void){
    char sa[101], sb[101], sc[101], drop, winner;
    scanf("%s%s%s", sa, sb, sc);
    for(int count=0;; count++){
        if(count==0||drop=='a'){
            winner='A';
            if(sa[0]=='\0') break;
            drop=sa[0];
            strcpy(sa, sa+1);
        }
        else if(drop=='b'){
            winner='B';
            if(sb[0]=='\0') break;
            drop=sb[0];
            strcpy(sb, sb+1);
        }
        else if(drop=='c'){
            winner='C';
            if(sc[0]=='\0') break;
            drop=sc[0];
            strcpy(sc, sc+1);
        }
    }
    printf("%c", winner);
    return 0;
}
abcb
aabb
bccc
 caa
accc
ca
 aaca
aabb
cccc
 abcb
bbaa
bccc
 aacb
bbaa
bccc
 aacb
bbaa
cccb
 aaca
bbaa
cccb
 aaca
aabb
cccb
 acaa
aabb
cccc
 acaa
abab
cccc

B A C B A A A A C C
Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <string.h>
int main(void){
    char sa[101], sb[101], sc[101], drop, winner;
    scanf("%s%s%s", sa, sb, sc);
    for(int count=0;; count++){
        if(count==0||drop=='a'){
            winner='A';
            if(sa[0]=='\0') break;
            drop=sa[0];
            strcpy(sa, sa+1);
        }
        else if(drop=='b'){
            winner='B';
            if(sb[0]=='\0') break;
            drop=sb[0];
            strcpy(sb, sb+1);
        }
        else if(drop=='c'){
            winner='C';
            if(sc[0]=='\0') break;
            drop=sc[0];
            strcpy(sc, sc+1);
        }
    }
    printf("%c", winner);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s%s%s"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$352, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-112(%rbp), %rcx
	leaq	-224(%rbp), %rdx
	leaq	-336(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -340(%rbp)
.L10:
	cmpl	$0, -340(%rbp)
	je	.L2
	cmpb	$97, -342(%rbp)
	jne	.L3
.L2:
	movb	$65, -341(%rbp)
	movzbl	-336(%rbp), %eax
	testb	%al, %al
	je	.L13
	movzbl	-336(%rbp), %eax
	movb	%al, -342(%rbp)
	leaq	-336(%rbp), %rax
	addq	$1, %rax
	leaq	-336(%rbp), %rdx
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcpy@PLT
	jmp	.L6
.L3:
	cmpb	$98, -342(%rbp)
	jne	.L7
	movb	$66, -341(%rbp)
	movzbl	-224(%rbp), %eax
	testb	%al, %al
	je	.L14
	movzbl	-224(%rbp), %eax
	movb	%al, -342(%rbp)
	leaq	-224(%rbp), %rax
	addq	$1, %rax
	leaq	-224(%rbp), %rdx
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcpy@PLT
	jmp	.L6
.L7:
	cmpb	$99, -342(%rbp)
	jne	.L6
	movb	$67, -341(%rbp)
	movzbl	-112(%rbp), %eax
	testb	%al, %al
	je	.L15
	movzbl	-112(%rbp), %eax
	movb	%al, -342(%rbp)
	leaq	-112(%rbp), %rax
	addq	$1, %rax
	leaq	-112(%rbp), %rdx
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcpy@PLT
.L6:
	addl	$1, -340(%rbp)
	jmp	.L10
.L13:
	nop
	jmp	.L5
.L14:
	nop
	jmp	.L5
.L15:
	nop
.L5:
	movsbl	-341(%rbp), %eax
	movl	%eax, %edi
	call	putchar@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s%s%s"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$352, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-112(%rbp), %rcx
	leaq	-224(%rbp), %rdx
	leaq	-336(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -340(%rbp)
.L10:
	cmpl	$0, -340(%rbp)
	je	.L2
	cmpb	$97, -342(%rbp)
	jne	.L3
.L2:
	movb	$65, -341(%rbp)
	movzbl	-336(%rbp), %eax
	testb	%al, %al
	je	.L13
	movzbl	-336(%rbp), %eax
	movb	%al, -342(%rbp)
	leaq	-336(%rbp), %rax
	addq	$1, %rax
	leaq	-336(%rbp), %rdx
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcpy@PLT
	jmp	.L6
.L3:
	cmpb	$98, -342(%rbp)
	jne	.L7
	movb	$66, -341(%rbp)
	movzbl	-224(%rbp), %eax
	testb	%al, %al
	je	.L14
	movzbl	-224(%rbp), %eax
	movb	%al, -342(%rbp)
	leaq	-224(%rbp), %rax
	addq	$1, %rax
	leaq	-224(%rbp), %rdx
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcpy@PLT
	jmp	.L6
.L7:
	cmpb	$99, -342(%rbp)
	jne	.L6
	movb	$67, -341(%rbp)
	movzbl	-112(%rbp), %eax
	testb	%al, %al
	je	.L15
	movzbl	-112(%rbp), %eax
	movb	%al, -342(%rbp)
	leaq	-112(%rbp), %rax
	addq	$1, %rax
	leaq	-112(%rbp), %rdx
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcpy@PLT
.L6:
	addl	$1, -340(%rbp)
	jmp	.L10
.L13:
	nop
	jmp	.L5
.L14:
	nop
	jmp	.L5
.L15:
	nop
.L5:
	movsbl	-341(%rbp), %eax
	movl	%eax, %edi
	call	putchar@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
