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(void) {
	int X, A, B;
	int N;
	int i;
	int asumikana;
	if (scanf("%d%d%d", &X, &A, &B) != 3) return 1;
	asumikana = X;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		char S[16];
		if (scanf("%15s", S) != 1) return 1;
		switch (S[0]) {
			case 'n': asumikana += A; break;
			case 't': asumikana += B; break;
			case 'k': asumikana = 0; break;
		}
		if (asumikana < 0) asumikana = 0;
	}
	printf("%d\n", asumikana);
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%15s"
.LC3:
	.string	"%d\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
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rcx
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$3, %eax
	je	.L2
	movl	$1, %eax
	jmp	.L12
.L2:
	movl	-56(%rbp), %eax
	movl	%eax, -36(%rbp)
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L4
	movl	$1, %eax
	jmp	.L12
.L4:
	movl	$0, -40(%rbp)
	jmp	.L5
.L11:
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L6
	movl	$1, %eax
	jmp	.L12
.L6:
	movzbl	-32(%rbp), %eax
	movsbl	%al, %eax
	cmpl	$116, %eax
	je	.L7
	cmpl	$116, %eax
	jg	.L8
	cmpl	$107, %eax
	je	.L9
	cmpl	$110, %eax
	jne	.L8
	movl	-52(%rbp), %eax
	addl	%eax, -36(%rbp)
	jmp	.L8
.L7:
	movl	-48(%rbp), %eax
	addl	%eax, -36(%rbp)
	jmp	.L8
.L9:
	movl	$0, -36(%rbp)
	nop
.L8:
	cmpl	$0, -36(%rbp)
	jns	.L10
	movl	$0, -36(%rbp)
.L10:
	addl	$1, -40(%rbp)
.L5:
	movl	-44(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L11
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L12:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%15s"
.LC3:
	.string	"%d\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
	leaq	.LC0(%rip), %rdi
	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
	subq	$48, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rcx
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	cmpl	$3, %eax
	je	.L2
.L4:
	movl	$1, %r13d
.L1:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$48, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	movl	%r13d, %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
.L2:
	.cfi_restore_state
	leaq	12(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	movl	(%rsp), %r12d
	call	__isoc99_scanf@PLT
	movl	%eax, %r13d
	cmpl	$1, %eax
	jne	.L4
	cmpl	$0, 12(%rsp)
	jle	.L5
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r14
	leaq	.LC2(%rip), %rbp
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L19:
	cmpb	$107, %al
	je	.L18
.L10:
	xorl	%eax, %eax
	testl	%r12d, %r12d
	cmovs	%eax, %r12d
.L9:
	addl	$1, %ebx
	cmpl	%ebx, 12(%rsp)
	jle	.L5
.L11:
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L1
	movzbl	16(%rsp), %eax
	cmpb	$110, %al
	je	.L7
	cmpb	$116, %al
	jne	.L19
	addl	8(%rsp), %r12d
	jmp	.L10
.L18:
	xorl	%r12d, %r12d
	jmp	.L9
.L7:
	addl	4(%rsp), %r12d
	jmp	.L10
.L5:
	movl	%r12d, %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L1
.L17:
	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%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%15s"
.LC3:
	.string	"%d\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
	leaq	.LC0(%rip), %rdi
	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
	subq	$48, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rcx
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	cmpl	$3, %eax
	je	.L2
.L4:
	movl	$1, %r13d
.L1:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$48, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	movl	%r13d, %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
.L2:
	.cfi_restore_state
	leaq	12(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	movl	(%rsp), %r12d
	call	__isoc99_scanf@PLT
	movl	%eax, %r13d
	cmpl	$1, %eax
	jne	.L4
	cmpl	$0, 12(%rsp)
	jle	.L5
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r14
	leaq	.LC2(%rip), %rbp
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L19:
	cmpb	$107, %al
	je	.L18
.L10:
	xorl	%eax, %eax
	testl	%r12d, %r12d
	cmovs	%eax, %r12d
.L9:
	addl	$1, %ebx
	cmpl	%ebx, 12(%rsp)
	jle	.L5
.L11:
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L1
	movzbl	16(%rsp), %eax
	cmpb	$110, %al
	je	.L7
	cmpb	$116, %al
	jne	.L19
	addl	8(%rsp), %r12d
	jmp	.L10
.L18:
	xorl	%r12d, %r12d
	jmp	.L9
.L7:
	addl	4(%rsp), %r12d
	jmp	.L10
.L5:
	movl	%r12d, %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L1
.L17:
	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(void) {
	int X, A, B;
	int N;
	int i;
	int asumikana;
	if (scanf("%d%d%d", &X, &A, &B) != 3) return 1;
	asumikana = X;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		char S[16];
		if (scanf("%15s", S) != 1) return 1;
		switch (S[0]) {
			case 'n': asumikana += A; break;
			case 't': asumikana += B; break;
			case 'k': asumikana = 0; break;
		}
		if (asumikana < 0) asumikana = 0;
	}
	printf("%d\n", asumikana);
	return 0;
}


10 30 10
0
nobiro
nobiro
tidime
 18 30 10
0
nobiro
nobiro
tidime
 15 30 9
0
noairo
oribon
midite
 23 30 9
0
noairo
oribon
midite
 44 30 5
0
noairo
nobiro
tidime
 59 30 5
0
oriaon
nobiro
tieimd
 83 48 5
0
orioan
nobiro
dmifit
 31 48 5
0
orioan
nobiro
dmifit
 19 48 5
0
orioan
nnciro
dmifit
 8 48 5
0
orioan
nnciro
dmifit

10
 18
 15
 23
 44
 59
 83
 31
 19
 8

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(void) {
	int X, A, B;
	int N;
	int i;
	int asumikana;
	if (scanf("%d%d%d", &X, &A, &B) != 3) return 1;
	asumikana = X;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		char S[16];
		if (scanf("%15s", S) != 1) return 1;
		switch (S[0]) {
			case 'n': asumikana += A; break;
			case 't': asumikana += B; break;
			case 'k': asumikana = 0; break;
		}
		if (asumikana < 0) asumikana = 0;
	}
	printf("%d\n", asumikana);
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%15s"
.LC3:
	.string	"%d\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
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rcx
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$3, %eax
	je	.L2
	movl	$1, %eax
	jmp	.L12
.L2:
	movl	-56(%rbp), %eax
	movl	%eax, -36(%rbp)
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L4
	movl	$1, %eax
	jmp	.L12
.L4:
	movl	$0, -40(%rbp)
	jmp	.L5
.L11:
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L6
	movl	$1, %eax
	jmp	.L12
.L6:
	movzbl	-32(%rbp), %eax
	movsbl	%al, %eax
	cmpl	$116, %eax
	je	.L7
	cmpl	$116, %eax
	jg	.L8
	cmpl	$107, %eax
	je	.L9
	cmpl	$110, %eax
	jne	.L8
	movl	-52(%rbp), %eax
	addl	%eax, -36(%rbp)
	jmp	.L8
.L7:
	movl	-48(%rbp), %eax
	addl	%eax, -36(%rbp)
	jmp	.L8
.L9:
	movl	$0, -36(%rbp)
	nop
.L8:
	cmpl	$0, -36(%rbp)
	jns	.L10
	movl	$0, -36(%rbp)
.L10:
	addl	$1, -40(%rbp)
.L5:
	movl	-44(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L11
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L12:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%15s"
.LC3:
	.string	"%d\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
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rcx
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$3, %eax
	je	.L2
	movl	$1, %eax
	jmp	.L12
.L2:
	movl	-56(%rbp), %eax
	movl	%eax, -36(%rbp)
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L4
	movl	$1, %eax
	jmp	.L12
.L4:
	movl	$0, -40(%rbp)
	jmp	.L5
.L11:
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L6
	movl	$1, %eax
	jmp	.L12
.L6:
	movzbl	-32(%rbp), %eax
	movsbl	%al, %eax
	cmpl	$116, %eax
	je	.L7
	cmpl	$116, %eax
	jg	.L8
	cmpl	$107, %eax
	je	.L9
	cmpl	$110, %eax
	jne	.L8
	movl	-52(%rbp), %eax
	addl	%eax, -36(%rbp)
	jmp	.L8
.L7:
	movl	-48(%rbp), %eax
	addl	%eax, -36(%rbp)
	jmp	.L8
.L9:
	movl	$0, -36(%rbp)
	nop
.L8:
	cmpl	$0, -36(%rbp)
	jns	.L10
	movl	$0, -36(%rbp)
.L10:
	addl	$1, -40(%rbp)
.L5:
	movl	-44(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L11
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L12:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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:
