Given the following C code and 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;
}

```

Assembly Code:

```assembly
	.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:
```

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	"%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
```assembly
	.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:
```
```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;
}

```
Given the following C 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;
}

```

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:

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 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;
}

```

Assembly Code:

```assembly
	.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:
```

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	"%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:
```