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

```c
char r[99],g[99],*G,d[99];main(c,i,k){for(;scanf("%s%s%s",r,g,d)>1;puts(""))for(i=k=0,G=g,c=*G++;*(G-1);)c==d[k]?k++,c=r[i++]:(putchar(c),c=*G++);exit(0);}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	""
.LC1:
	.string	"%s%s%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	g(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	r(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	d(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbx, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	call	scanf@PLT
	cmpl	$1, %eax
	jle	.L15
	movsbl	(%r12), %edi
	leaq	1+g(%rip), %rax
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
	movq	%rax, G(%rip)
	testb	%dil, %dil
	je	.L6
.L3:
	movsbl	(%rbx,%r15), %eax
	cmpl	%edi, %eax
	jne	.L4
.L16:
	addl	$1, %r14d
	movsbl	0(%rbp,%r15), %edi
	movslq	%r14d, %r15
	movsbl	(%rbx,%r15), %eax
	cmpl	%edi, %eax
	je	.L16
.L4:
	call	putchar@PLT
	movq	G(%rip), %rax
	leaq	1(%rax), %rsi
	movq	%rsi, G(%rip)
	movsbl	(%rax), %edi
	testb	%dil, %dil
	jne	.L3
.L6:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L15:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 99
d:
	.zero	99
	.globl	G
	.align 8
	.type	G, @object
	.size	G, 8
G:
	.zero	8
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 99
g:
	.zero	99
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 99
r:
	.zero	99
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	""
.LC1:
	.string	"%s%s%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	g(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	r(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	d(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbx, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	call	scanf@PLT
	cmpl	$1, %eax
	jle	.L15
	movsbl	(%r12), %edi
	leaq	1+g(%rip), %rax
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
	movq	%rax, G(%rip)
	testb	%dil, %dil
	je	.L6
.L3:
	movsbl	(%rbx,%r15), %eax
	cmpl	%edi, %eax
	jne	.L4
.L16:
	addl	$1, %r14d
	movsbl	0(%rbp,%r15), %edi
	movslq	%r14d, %r15
	movsbl	(%rbx,%r15), %eax
	cmpl	%edi, %eax
	je	.L16
.L4:
	call	putchar@PLT
	movq	G(%rip), %rax
	leaq	1(%rax), %rsi
	movq	%rsi, G(%rip)
	movsbl	(%rax), %edi
	testb	%dil, %dil
	jne	.L3
.L6:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L15:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 99
d:
	.zero	99
	.globl	G
	.align 8
	.type	G, @object
	.size	G, 8
G:
	.zero	8
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 99
g:
	.zero	99
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 99
r:
	.zero	99
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	""
.LC1:
	.string	"%s%s%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	g(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	r(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	d(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbx, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	call	scanf@PLT
	cmpl	$1, %eax
	jle	.L15
	movsbl	(%r12), %edi
	leaq	1+g(%rip), %rax
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
	movq	%rax, G(%rip)
	testb	%dil, %dil
	je	.L6
.L3:
	movsbl	(%rbx,%r15), %eax
	cmpl	%edi, %eax
	jne	.L4
.L16:
	addl	$1, %r14d
	movsbl	0(%rbp,%r15), %edi
	movslq	%r14d, %r15
	movsbl	(%rbx,%r15), %eax
	cmpl	%edi, %eax
	je	.L16
.L4:
	call	putchar@PLT
	movq	G(%rip), %rax
	leaq	1(%rax), %rsi
	movq	%rsi, G(%rip)
	movsbl	(%rax), %edi
	testb	%dil, %dil
	jne	.L3
.L6:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L15:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 99
d:
	.zero	99
	.globl	G
	.align 8
	.type	G, @object
	.size	G, 8
G:
	.zero	8
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 99
g:
	.zero	99
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 99
r:
	.zero	99
	.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:
```
```c
char r[99],g[99],*G,d[99];main(c,i,k){for(;scanf("%s%s%s",r,g,d)>1;puts(""))for(i=k=0,G=g,c=*G++;*(G-1);)c==d[k]?k++,c=r[i++]:(putchar(c),c=*G++);exit(0);}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
char r[99],g[99],*G,d[99];main(c,i,k){for(;scanf("%s%s%s",r,g,d)>1;puts(""))for(i=k=0,G=g,c=*G++;*(G-1);)c==d[k]?k++,c=r[i++]:(putchar(c),c=*G++);exit(0);}```

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.
Optimized Assembly Code:

CBA
cba
cCa
X
YZ
Z
-
 CBA
cba
cCa
Y
YZ
Z
-
 CBA
cca
cCa
X
ZY
Z
-
 CAB
cba
cCa
X
YZ
Z
-
 CAB
cca
cCa
X
YZ
Z
-
 CAA
cca
cCa
X
YZ
Z
-
 CBA
abc
aCc
X
ZY
Z
-
 CBA
cba
cCa
X
XZ
Z
-
 CBB
cca
cCa
X
ZY
Z
-
 CAB
cba
cCa
X
ZY
Z
-

BbA
YX
 BbA
YY
 BcA
XY
 AbB
YX
 AcB
YX
 AcA
YX
 BbA
XY
 BbA
XX
 BcB
XY
 AbB
XY

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

```c
char r[99],g[99],*G,d[99];main(c,i,k){for(;scanf("%s%s%s",r,g,d)>1;puts(""))for(i=k=0,G=g,c=*G++;*(G-1);)c==d[k]?k++,c=r[i++]:(putchar(c),c=*G++);exit(0);}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	""
.LC1:
	.string	"%s%s%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	g(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	r(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	d(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbx, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	call	scanf@PLT
	cmpl	$1, %eax
	jle	.L15
	movsbl	(%r12), %edi
	leaq	1+g(%rip), %rax
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
	movq	%rax, G(%rip)
	testb	%dil, %dil
	je	.L6
.L3:
	movsbl	(%rbx,%r15), %eax
	cmpl	%edi, %eax
	jne	.L4
.L16:
	addl	$1, %r14d
	movsbl	0(%rbp,%r15), %edi
	movslq	%r14d, %r15
	movsbl	(%rbx,%r15), %eax
	cmpl	%edi, %eax
	je	.L16
.L4:
	call	putchar@PLT
	movq	G(%rip), %rax
	leaq	1(%rax), %rsi
	movq	%rsi, G(%rip)
	movsbl	(%rax), %edi
	testb	%dil, %dil
	jne	.L3
.L6:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L15:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 99
d:
	.zero	99
	.globl	G
	.align 8
	.type	G, @object
	.size	G, 8
G:
	.zero	8
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 99
g:
	.zero	99
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 99
r:
	.zero	99
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	""
.LC1:
	.string	"%s%s%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	g(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	r(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	d(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbx, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	call	scanf@PLT
	cmpl	$1, %eax
	jle	.L15
	movsbl	(%r12), %edi
	leaq	1+g(%rip), %rax
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
	movq	%rax, G(%rip)
	testb	%dil, %dil
	je	.L6
.L3:
	movsbl	(%rbx,%r15), %eax
	cmpl	%edi, %eax
	jne	.L4
.L16:
	addl	$1, %r14d
	movsbl	0(%rbp,%r15), %edi
	movslq	%r14d, %r15
	movsbl	(%rbx,%r15), %eax
	cmpl	%edi, %eax
	je	.L16
.L4:
	call	putchar@PLT
	movq	G(%rip), %rax
	leaq	1(%rax), %rsi
	movq	%rsi, G(%rip)
	movsbl	(%rax), %edi
	testb	%dil, %dil
	jne	.L3
.L6:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L15:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 99
d:
	.zero	99
	.globl	G
	.align 8
	.type	G, @object
	.size	G, 8
G:
	.zero	8
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 99
g:
	.zero	99
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 99
r:
	.zero	99
	.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:
```