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 wa[100010];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	int ac=0,pena=0;
	for(int i=0;i<m;i++){
		int p;
		char s[9];
		scanf("%d%s",&p,s);
		if(wa[p]!=-1){
			if(s[0]=='A'){
				ac++;
				pena+=wa[p];
				wa[p]=-1;
			}else{
				wa[p]++;
			}
		}
	}
	printf("%d %d",ac,pena);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	wa
	.bss
	.align 32
	.type	wa, @object
	.size	wa, 400040
wa:
	.zero	400040
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d%s"
.LC2:
	.string	"%d %d"
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -32(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L2
.L5:
	leaq	-17(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wa(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L3
	movzbl	-17(%rbp), %eax
	cmpb	$65, %al
	jne	.L4
	addl	$1, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wa(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wa(%rip), %rax
	movl	$-1, (%rdx,%rax)
	jmp	.L3
.L4:
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	wa(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wa(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L3:
	addl	$1, -24(%rbp)
.L2:
	movl	-40(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L5
	movl	-28(%rbp), %edx
	movl	-32(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	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%d"
.LC1:
	.string	"%d%s"
.LC2:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rdx
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L7
	xorl	%r14d, %r14d
	leaq	31(%rsp), %r13
	leaq	24(%rsp), %r12
	xorl	%r15d, %r15d
	movl	$0, 12(%rsp)
	leaq	.LC1(%rip), %rbp
	leaq	wa(%rip), %rbx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %eax
	movl	%eax, (%rbx,%rdx,4)
.L3:
	addl	$1, %r14d
	cmpl	%r14d, 20(%rsp)
	jle	.L2
.L5:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rdx
	movl	(%rbx,%rdx,4), %eax
	cmpl	$-1, %eax
	je	.L3
	cmpb	$65, 31(%rsp)
	jne	.L4
	addl	$1, 12(%rsp)
	addl	%eax, %r15d
	addl	$1, %r14d
	movl	$-1, (%rbx,%rdx,4)
	cmpl	%r14d, 20(%rsp)
	jg	.L5
	.p2align 4,,10
	.p2align 3
.L2:
	movl	12(%rsp), %edx
	xorl	%eax, %eax
	movl	%r15d, %ecx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$56, %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
.L7:
	.cfi_restore_state
	movl	$0, 12(%rsp)
	xorl	%r15d, %r15d
	jmp	.L2
.L14:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	wa
	.bss
	.align 32
	.type	wa, @object
	.size	wa, 400040
wa:
	.zero	400040
	.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%d"
.LC1:
	.string	"%d%s"
.LC2:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rdx
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L7
	xorl	%r14d, %r14d
	leaq	31(%rsp), %r13
	leaq	24(%rsp), %r12
	xorl	%r15d, %r15d
	movl	$0, 12(%rsp)
	leaq	.LC1(%rip), %rbp
	leaq	wa(%rip), %rbx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %eax
	movl	%eax, (%rbx,%rdx,4)
.L3:
	addl	$1, %r14d
	cmpl	%r14d, 20(%rsp)
	jle	.L2
.L5:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rdx
	movl	(%rbx,%rdx,4), %eax
	cmpl	$-1, %eax
	je	.L3
	cmpb	$65, 31(%rsp)
	jne	.L4
	addl	$1, 12(%rsp)
	addl	%eax, %r15d
	addl	$1, %r14d
	movl	$-1, (%rbx,%rdx,4)
	cmpl	%r14d, 20(%rsp)
	jg	.L5
	.p2align 4,,10
	.p2align 3
.L2:
	movl	12(%rsp), %edx
	xorl	%eax, %eax
	movl	%r15d, %ecx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$56, %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
.L7:
	.cfi_restore_state
	movl	$0, 12(%rsp)
	xorl	%r15d, %r15d
	jmp	.L2
.L14:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	wa
	.bss
	.align 32
	.type	wa, @object
	.size	wa, 400040
wa:
	.zero	400040
	.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 wa[100010];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	int ac=0,pena=0;
	for(int i=0;i<m;i++){
		int p;
		char s[9];
		scanf("%d%s",&p,s);
		if(wa[p]!=-1){
			if(s[0]=='A'){
				ac++;
				pena+=wa[p];
				wa[p]=-1;
			}else{
				wa[p]++;
			}
		}
	}
	printf("%d %d",ac,pena);
}
100000 3
7777 AC
7777 AC
7777 CA
 100000 3
12676 AC
7777 AC
7777 CA
 1 0
 4 5
1 WA
1 AC
2 WA
2 AC
2 WA
 4 5
1 WA
1 AC
0 WA
2 AC
2 WA
 100000 3
6234 AC
7777 AC
7777 AC
 2 0
 2 -1
 2 -2
 2 -4

1 0 2 0 0 0 2 2 2 1 2 0 0 0 0 0 0 0 0 0
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 wa[100010];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	int ac=0,pena=0;
	for(int i=0;i<m;i++){
		int p;
		char s[9];
		scanf("%d%s",&p,s);
		if(wa[p]!=-1){
			if(s[0]=='A'){
				ac++;
				pena+=wa[p];
				wa[p]=-1;
			}else{
				wa[p]++;
			}
		}
	}
	printf("%d %d",ac,pena);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	wa
	.bss
	.align 32
	.type	wa, @object
	.size	wa, 400040
wa:
	.zero	400040
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d%s"
.LC2:
	.string	"%d %d"
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -32(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L2
.L5:
	leaq	-17(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wa(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L3
	movzbl	-17(%rbp), %eax
	cmpb	$65, %al
	jne	.L4
	addl	$1, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wa(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wa(%rip), %rax
	movl	$-1, (%rdx,%rax)
	jmp	.L3
.L4:
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	wa(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wa(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L3:
	addl	$1, -24(%rbp)
.L2:
	movl	-40(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L5
	movl	-28(%rbp), %edx
	movl	-32(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	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
	.globl	wa
	.bss
	.align 32
	.type	wa, @object
	.size	wa, 400040
wa:
	.zero	400040
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d%s"
.LC2:
	.string	"%d %d"
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -32(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L2
.L5:
	leaq	-17(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wa(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L3
	movzbl	-17(%rbp), %eax
	cmpb	$65, %al
	jne	.L4
	addl	$1, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wa(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wa(%rip), %rax
	movl	$-1, (%rdx,%rax)
	jmp	.L3
.L4:
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	wa(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wa(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L3:
	addl	$1, -24(%rbp)
.L2:
	movl	-40(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L5
	movl	-28(%rbp), %edx
	movl	-32(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	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:
