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>

int main()
{	
	int N, Q;
	char S[1000001];
	scanf("%d", &N);
	scanf("%s", S);
	scanf("%d", &Q);
	
	int i, k, q;
	long long ans, tmp[3];
	for (q = 1; q <= Q; q++) {
		scanf("%d", &k);
		ans = 0;
		tmp[0] = 0;
		tmp[1] = 0;
		tmp[2] = 0;
		
		for (i = 0; i < k; i++) {
			if (S[i] == 'D') tmp[0]++;
			else if (S[i] == 'M') {
				tmp[1]++;
				tmp[2] += tmp[0];
			} else if (S[i] == 'C') ans += tmp[2];
		}
		for (; S[i] != 0; i++) {
			if (S[i-k] == 'D') {
				tmp[0]--;
				tmp[2] -= tmp[1];
			} else if (S[i-k] == 'M') tmp[1]--;
			if (S[i] == 'D') tmp[0]++;
			else if (S[i] == 'M') {
				tmp[1]++;
				tmp[2] += tmp[0];
			} else if (S[i] == 'C') ans += tmp[2];
		}
		
		printf("%lld\n", ans);
	}
	
	fflush(stdout);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.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
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$656, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1000076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1000016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1000072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -1000060(%rbp)
	jmp	.L2
.L15:
	leaq	-1000068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -1000056(%rbp)
	movq	$0, -1000048(%rbp)
	movq	$0, -1000040(%rbp)
	movq	$0, -1000032(%rbp)
	movl	$0, -1000064(%rbp)
	jmp	.L3
.L7:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$68, %al
	jne	.L4
	movq	-1000048(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -1000048(%rbp)
	jmp	.L5
.L4:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$77, %al
	jne	.L6
	movq	-1000040(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -1000040(%rbp)
	movq	-1000032(%rbp), %rdx
	movq	-1000048(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -1000032(%rbp)
	jmp	.L5
.L6:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$67, %al
	jne	.L5
	movq	-1000032(%rbp), %rax
	addq	%rax, -1000056(%rbp)
.L5:
	addl	$1, -1000064(%rbp)
.L3:
	movl	-1000068(%rbp), %eax
	cmpl	%eax, -1000064(%rbp)
	jl	.L7
	jmp	.L8
.L14:
	movl	-1000068(%rbp), %edx
	movl	-1000064(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$68, %al
	jne	.L9
	movq	-1000048(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -1000048(%rbp)
	movq	-1000032(%rbp), %rax
	movq	-1000040(%rbp), %rdx
	subq	%rdx, %rax
	movq	%rax, -1000032(%rbp)
	jmp	.L10
.L9:
	movl	-1000068(%rbp), %edx
	movl	-1000064(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$77, %al
	jne	.L10
	movq	-1000040(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -1000040(%rbp)
.L10:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$68, %al
	jne	.L11
	movq	-1000048(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -1000048(%rbp)
	jmp	.L12
.L11:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$77, %al
	jne	.L13
	movq	-1000040(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -1000040(%rbp)
	movq	-1000032(%rbp), %rdx
	movq	-1000048(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -1000032(%rbp)
	jmp	.L12
.L13:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$67, %al
	jne	.L12
	movq	-1000032(%rbp), %rax
	addq	%rax, -1000056(%rbp)
.L12:
	addl	$1, -1000064(%rbp)
.L8:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L14
	movq	-1000056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1000060(%rbp)
.L2:
	movl	-1000072(%rbp), %eax
	cmpl	%eax, -1000060(%rbp)
	jle	.L15
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-999424(%rsp), %r11
	.cfi_def_cfa 11, 999472
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$608, %rsp
	.cfi_def_cfa_offset 1000080
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1000024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	leaq	16(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	8(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	movl	$1, %ebx
	leaq	12(%rsp), %r14
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	testl	%esi, %esi
	jle	.L17
	leal	-1(%rsi), %edx
	movq	%rbp, %rax
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	leaq	17(%rsp,%rdx), %r10
	xorl	%edi, %edi
	xorl	%r8d, %r8d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$77, %dl
	je	.L26
	leaq	(%r8,%r9), %r11
	cmpb	$67, %dl
	cmove	%r11, %r8
.L5:
	addq	$1, %rax
	cmpq	%r10, %rax
	je	.L27
.L7:
	movzbl	(%rax), %edx
	cmpb	$68, %dl
	jne	.L4
	addq	$1, %rax
	addq	$1, %rdi
	cmpq	%r10, %rax
	jne	.L7
.L27:
	movl	%esi, %r10d
.L3:
	movslq	%r10d, %r11
	movzbl	16(%rsp,%r11), %eax
	testb	%al, %al
	je	.L8
	subl	%esi, %r10d
	leaq	0(%rbp,%r11), %rdx
	movslq	%r10d, %r10
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L9:
	cmpb	$77, %sil
	sete	%sil
	movzbl	%sil, %esi
	subq	%rsi, %rcx
	cmpb	$68, %al
	je	.L28
.L11:
	cmpb	$77, %al
	je	.L29
	leaq	(%r8,%r9), %rsi
	cmpb	$67, %al
	cmove	%rsi, %r8
.L12:
	movzbl	1(%rdx), %eax
	addq	$1, %rdx
	testb	%al, %al
	je	.L8
.L14:
	movq	%rdx, %rsi
	subq	%r11, %rsi
	movzbl	(%rsi,%r10), %esi
	cmpb	$68, %sil
	jne	.L9
	subq	$1, %rdi
	subq	%rcx, %r9
	cmpb	$68, %al
	jne	.L11
.L28:
	movzbl	1(%rdx), %eax
	addq	$1, %rdx
	addq	$1, %rdi
	testb	%al, %al
	jne	.L14
.L8:
	movq	%r8, %rdx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addl	$1, %ebx
	cmpl	%ebx, 8(%rsp)
	jge	.L15
.L2:
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	1000024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$1000032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	addq	$1, %rcx
	addq	%rdi, %r9
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L29:
	addq	$1, %rcx
	addq	%rdi, %r9
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L17:
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	xorl	%r8d, %r8d
	xorl	%r10d, %r10d
	jmp	.L3
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-999424(%rsp), %r11
	.cfi_def_cfa 11, 999472
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$608, %rsp
	.cfi_def_cfa_offset 1000080
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1000024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	leaq	16(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	8(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	movl	$1, %ebx
	leaq	12(%rsp), %r14
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	testl	%esi, %esi
	jle	.L17
	leal	-1(%rsi), %edx
	movq	%rbp, %rax
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	leaq	17(%rsp,%rdx), %r10
	xorl	%edi, %edi
	xorl	%r8d, %r8d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$77, %dl
	je	.L26
	leaq	(%r8,%r9), %r11
	cmpb	$67, %dl
	cmove	%r11, %r8
.L5:
	addq	$1, %rax
	cmpq	%r10, %rax
	je	.L27
.L7:
	movzbl	(%rax), %edx
	cmpb	$68, %dl
	jne	.L4
	addq	$1, %rax
	addq	$1, %rdi
	cmpq	%r10, %rax
	jne	.L7
.L27:
	movl	%esi, %r10d
.L3:
	movslq	%r10d, %r11
	movzbl	16(%rsp,%r11), %eax
	testb	%al, %al
	je	.L8
	subl	%esi, %r10d
	leaq	0(%rbp,%r11), %rdx
	movslq	%r10d, %r10
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L9:
	cmpb	$77, %sil
	sete	%sil
	movzbl	%sil, %esi
	subq	%rsi, %rcx
	cmpb	$68, %al
	je	.L28
.L11:
	cmpb	$77, %al
	je	.L29
	leaq	(%r8,%r9), %rsi
	cmpb	$67, %al
	cmove	%rsi, %r8
.L12:
	movzbl	1(%rdx), %eax
	addq	$1, %rdx
	testb	%al, %al
	je	.L8
.L14:
	movq	%rdx, %rsi
	subq	%r11, %rsi
	movzbl	(%rsi,%r10), %esi
	cmpb	$68, %sil
	jne	.L9
	subq	$1, %rdi
	subq	%rcx, %r9
	cmpb	$68, %al
	jne	.L11
.L28:
	movzbl	1(%rdx), %eax
	addq	$1, %rdx
	addq	$1, %rdi
	testb	%al, %al
	jne	.L14
.L8:
	movq	%r8, %rdx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addl	$1, %ebx
	cmpl	%ebx, 8(%rsp)
	jge	.L15
.L2:
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	1000024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$1000032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	addq	$1, %rcx
	addq	%rdi, %r9
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L29:
	addq	$1, %rcx
	addq	%rdi, %r9
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L17:
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	xorl	%r8d, %r8d
	xorl	%r10d, %r10d
	jmp	.L3
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>

int main()
{	
	int N, Q;
	char S[1000001];
	scanf("%d", &N);
	scanf("%s", S);
	scanf("%d", &Q);
	
	int i, k, q;
	long long ans, tmp[3];
	for (q = 1; q <= Q; q++) {
		scanf("%d", &k);
		ans = 0;
		tmp[0] = 0;
		tmp[1] = 0;
		tmp[2] = 0;
		
		for (i = 0; i < k; i++) {
			if (S[i] == 'D') tmp[0]++;
			else if (S[i] == 'M') {
				tmp[1]++;
				tmp[2] += tmp[0];
			} else if (S[i] == 'C') ans += tmp[2];
		}
		for (; S[i] != 0; i++) {
			if (S[i-k] == 'D') {
				tmp[0]--;
				tmp[2] -= tmp[1];
			} else if (S[i-k] == 'M') tmp[1]--;
			if (S[i] == 'D') tmp[0]++;
			else if (S[i] == 'M') {
				tmp[1]++;
				tmp[2] += tmp[0];
			} else if (S[i] == 'C') ans += tmp[2];
		}
		
		printf("%lld\n", ans);
	}
	
	fflush(stdout);
	return 0;
}
18
RETSULCAIDEMOGNAWD
1
18
 18
DDEDDDMMMMMCCCCCCC
1
18
 30
DMCDMCDNCDMCDMCDMCDMCDMCDMCDMC
4
5 10 15 20
 30
DMCDMCDNCDMCDMCDMCDMCDMCDMCDMC
4
5 10 15 9
 30
DMCDMCDNCDMCDMCDMCEMCDMCDMCDMC
4
5 10 15 9
 30
DMCDMCDNCDMCDMCDMCEMCDMCDMCDMC
4
5 10 15 7
 30
DMCDMCDNCDMCDMCDMCEMCDMCDMCDMC
4
5 10 15 1
 54
DIALUPWIDEAREADETWORKGAMINGOPERATIONCORPORATIONLIMITEN
3
20 30 40
 18
DWANGOMEDIACLUSTER
1
32
 18
DDDDDDMMMMMCCCCCCC
1
29

0
 175
 9
46
98
125
 9
46
98
46
 8
40
88
40
 8
40
88
22
 8
40
88
0
 0
2
3
 1
 210

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>

int main()
{	
	int N, Q;
	char S[1000001];
	scanf("%d", &N);
	scanf("%s", S);
	scanf("%d", &Q);
	
	int i, k, q;
	long long ans, tmp[3];
	for (q = 1; q <= Q; q++) {
		scanf("%d", &k);
		ans = 0;
		tmp[0] = 0;
		tmp[1] = 0;
		tmp[2] = 0;
		
		for (i = 0; i < k; i++) {
			if (S[i] == 'D') tmp[0]++;
			else if (S[i] == 'M') {
				tmp[1]++;
				tmp[2] += tmp[0];
			} else if (S[i] == 'C') ans += tmp[2];
		}
		for (; S[i] != 0; i++) {
			if (S[i-k] == 'D') {
				tmp[0]--;
				tmp[2] -= tmp[1];
			} else if (S[i-k] == 'M') tmp[1]--;
			if (S[i] == 'D') tmp[0]++;
			else if (S[i] == 'M') {
				tmp[1]++;
				tmp[2] += tmp[0];
			} else if (S[i] == 'C') ans += tmp[2];
		}
		
		printf("%lld\n", ans);
	}
	
	fflush(stdout);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.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
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$656, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1000076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1000016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1000072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -1000060(%rbp)
	jmp	.L2
.L15:
	leaq	-1000068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -1000056(%rbp)
	movq	$0, -1000048(%rbp)
	movq	$0, -1000040(%rbp)
	movq	$0, -1000032(%rbp)
	movl	$0, -1000064(%rbp)
	jmp	.L3
.L7:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$68, %al
	jne	.L4
	movq	-1000048(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -1000048(%rbp)
	jmp	.L5
.L4:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$77, %al
	jne	.L6
	movq	-1000040(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -1000040(%rbp)
	movq	-1000032(%rbp), %rdx
	movq	-1000048(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -1000032(%rbp)
	jmp	.L5
.L6:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$67, %al
	jne	.L5
	movq	-1000032(%rbp), %rax
	addq	%rax, -1000056(%rbp)
.L5:
	addl	$1, -1000064(%rbp)
.L3:
	movl	-1000068(%rbp), %eax
	cmpl	%eax, -1000064(%rbp)
	jl	.L7
	jmp	.L8
.L14:
	movl	-1000068(%rbp), %edx
	movl	-1000064(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$68, %al
	jne	.L9
	movq	-1000048(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -1000048(%rbp)
	movq	-1000032(%rbp), %rax
	movq	-1000040(%rbp), %rdx
	subq	%rdx, %rax
	movq	%rax, -1000032(%rbp)
	jmp	.L10
.L9:
	movl	-1000068(%rbp), %edx
	movl	-1000064(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$77, %al
	jne	.L10
	movq	-1000040(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -1000040(%rbp)
.L10:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$68, %al
	jne	.L11
	movq	-1000048(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -1000048(%rbp)
	jmp	.L12
.L11:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$77, %al
	jne	.L13
	movq	-1000040(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -1000040(%rbp)
	movq	-1000032(%rbp), %rdx
	movq	-1000048(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -1000032(%rbp)
	jmp	.L12
.L13:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$67, %al
	jne	.L12
	movq	-1000032(%rbp), %rax
	addq	%rax, -1000056(%rbp)
.L12:
	addl	$1, -1000064(%rbp)
.L8:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L14
	movq	-1000056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1000060(%rbp)
.L2:
	movl	-1000072(%rbp), %eax
	cmpl	%eax, -1000060(%rbp)
	jle	.L15
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.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
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$656, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1000076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1000016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1000072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -1000060(%rbp)
	jmp	.L2
.L15:
	leaq	-1000068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -1000056(%rbp)
	movq	$0, -1000048(%rbp)
	movq	$0, -1000040(%rbp)
	movq	$0, -1000032(%rbp)
	movl	$0, -1000064(%rbp)
	jmp	.L3
.L7:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$68, %al
	jne	.L4
	movq	-1000048(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -1000048(%rbp)
	jmp	.L5
.L4:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$77, %al
	jne	.L6
	movq	-1000040(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -1000040(%rbp)
	movq	-1000032(%rbp), %rdx
	movq	-1000048(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -1000032(%rbp)
	jmp	.L5
.L6:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$67, %al
	jne	.L5
	movq	-1000032(%rbp), %rax
	addq	%rax, -1000056(%rbp)
.L5:
	addl	$1, -1000064(%rbp)
.L3:
	movl	-1000068(%rbp), %eax
	cmpl	%eax, -1000064(%rbp)
	jl	.L7
	jmp	.L8
.L14:
	movl	-1000068(%rbp), %edx
	movl	-1000064(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$68, %al
	jne	.L9
	movq	-1000048(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -1000048(%rbp)
	movq	-1000032(%rbp), %rax
	movq	-1000040(%rbp), %rdx
	subq	%rdx, %rax
	movq	%rax, -1000032(%rbp)
	jmp	.L10
.L9:
	movl	-1000068(%rbp), %edx
	movl	-1000064(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$77, %al
	jne	.L10
	movq	-1000040(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -1000040(%rbp)
.L10:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$68, %al
	jne	.L11
	movq	-1000048(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -1000048(%rbp)
	jmp	.L12
.L11:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$77, %al
	jne	.L13
	movq	-1000040(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -1000040(%rbp)
	movq	-1000032(%rbp), %rdx
	movq	-1000048(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -1000032(%rbp)
	jmp	.L12
.L13:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	cmpb	$67, %al
	jne	.L12
	movq	-1000032(%rbp), %rax
	addq	%rax, -1000056(%rbp)
.L12:
	addl	$1, -1000064(%rbp)
.L8:
	movl	-1000064(%rbp), %eax
	cltq
	movzbl	-1000016(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L14
	movq	-1000056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1000060(%rbp)
.L2:
	movl	-1000072(%rbp), %eax
	cmpl	%eax, -1000060(%rbp)
	jle	.L15
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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:
