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>
#include <stdlib.h>
#include <string.h>
#include <math.h>


int main(){
	int X;
	char command[10];
	int A,B,N;

	scanf("%d %d %d",&X,&A,&B);
	scanf("%d",&N);

	for(int i=0;i<N;i++){
		scanf("%s",command);
		if(strcmp(command,"nobiro")==0){
			X+=A;
		}else if(strcmp(command,"tidime")==0){
			X+=B;
		}else{
			X=0;
		}
		if(X<0){
			X=0;
		}
	}

	printf("%d\n",X);

	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	"%s"
.LC3:
	.string	"nobiro"
.LC4:
	.string	"tidime"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rcx
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	24(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebp, %ebp
	leaq	30(%rsp), %rbx
	leaq	.LC2(%rip), %r12
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L3:
	cmpl	$1768188276, (%rbx)
	je	.L17
.L9:
	movl	$0, 12(%rsp)
	xorl	%edx, %edx
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jle	.L12
.L11:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1768058734, (%rbx)
	jne	.L3
	cmpw	$28530, 4(%rbx)
	jne	.L3
	cmpb	$0, 6(%rbx)
	jne	.L3
	movl	16(%rsp), %edx
	addl	12(%rsp), %edx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L17:
	cmpw	$25965, 4(%rbx)
	jne	.L9
	cmpb	$0, 6(%rbx)
	jne	.L9
	movl	20(%rsp), %edx
	addl	12(%rsp), %edx
.L6:
	movl	%edx, 12(%rsp)
	testl	%edx, %edx
	js	.L9
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jg	.L11
.L12:
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$48, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movl	12(%rsp), %edx
	jmp	.L12
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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	"%s"
.LC3:
	.string	"nobiro"
.LC4:
	.string	"tidime"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rcx
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	24(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebp, %ebp
	leaq	30(%rsp), %rbx
	leaq	.LC2(%rip), %r12
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L3:
	cmpl	$1768188276, (%rbx)
	je	.L17
.L9:
	movl	$0, 12(%rsp)
	xorl	%edx, %edx
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jle	.L12
.L11:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1768058734, (%rbx)
	jne	.L3
	cmpw	$28530, 4(%rbx)
	jne	.L3
	cmpb	$0, 6(%rbx)
	jne	.L3
	movl	16(%rsp), %edx
	addl	12(%rsp), %edx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L17:
	cmpw	$25965, 4(%rbx)
	jne	.L9
	cmpb	$0, 6(%rbx)
	jne	.L9
	movl	20(%rsp), %edx
	addl	12(%rsp), %edx
.L6:
	movl	%edx, 12(%rsp)
	testl	%edx, %edx
	js	.L9
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jg	.L11
.L12:
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$48, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movl	12(%rsp), %edx
	jmp	.L12
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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	"%s"
.LC3:
	.string	"nobiro"
.LC4:
	.string	"tidime"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rcx
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	24(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebp, %ebp
	leaq	30(%rsp), %rbx
	leaq	.LC2(%rip), %r12
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L3:
	cmpl	$1768188276, (%rbx)
	je	.L17
.L9:
	movl	$0, 12(%rsp)
	xorl	%edx, %edx
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jle	.L12
.L11:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1768058734, (%rbx)
	jne	.L3
	cmpw	$28530, 4(%rbx)
	jne	.L3
	cmpb	$0, 6(%rbx)
	jne	.L3
	movl	16(%rsp), %edx
	addl	12(%rsp), %edx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L17:
	cmpw	$25965, 4(%rbx)
	jne	.L9
	cmpb	$0, 6(%rbx)
	jne	.L9
	movl	20(%rsp), %edx
	addl	12(%rsp), %edx
.L6:
	movl	%edx, 12(%rsp)
	testl	%edx, %edx
	js	.L9
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jg	.L11
.L12:
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$48, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movl	12(%rsp), %edx
	jmp	.L12
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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>
#include <stdlib.h>
#include <string.h>
#include <math.h>


int main(){
	int X;
	char command[10];
	int A,B,N;

	scanf("%d %d %d",&X,&A,&B);
	scanf("%d",&N);

	for(int i=0;i<N;i++){
		scanf("%s",command);
		if(strcmp(command,"nobiro")==0){
			X+=A;
		}else if(strcmp(command,"tidime")==0){
			X+=B;
		}else{
			X=0;
		}
		if(X<0){
			X=0;
		}
	}

	printf("%d\n",X);

	return 0;
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>


int main(){
	int X;
	char command[10];
	int A,B,N;

	scanf("%d %d %d",&X,&A,&B);
	scanf("%d",&N);

	for(int i=0;i<N;i++){
		scanf("%s",command);
		if(strcmp(command,"nobiro")==0){
			X+=A;
		}else if(strcmp(command,"tidime")==0){
			X+=B;
		}else{
			X=0;
		}
		if(X<0){
			X=0;
		}
	}

	printf("%d\n",X);

	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>
#include <stdlib.h>
#include <string.h>
#include <math.h>


int main(){
	int X;
	char command[10];
	int A,B,N;

	scanf("%d %d %d",&X,&A,&B);
	scanf("%d",&N);

	for(int i=0;i<N;i++){
		scanf("%s",command);
		if(strcmp(command,"nobiro")==0){
			X+=A;
		}else if(strcmp(command,"tidime")==0){
			X+=B;
		}else{
			X=0;
		}
		if(X<0){
			X=0;
		}
	}

	printf("%d\n",X);

	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	"%s"
.LC3:
	.string	"nobiro"
.LC4:
	.string	"tidime"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rcx
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	24(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebp, %ebp
	leaq	30(%rsp), %rbx
	leaq	.LC2(%rip), %r12
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L3:
	cmpl	$1768188276, (%rbx)
	je	.L17
.L9:
	movl	$0, 12(%rsp)
	xorl	%edx, %edx
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jle	.L12
.L11:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1768058734, (%rbx)
	jne	.L3
	cmpw	$28530, 4(%rbx)
	jne	.L3
	cmpb	$0, 6(%rbx)
	jne	.L3
	movl	16(%rsp), %edx
	addl	12(%rsp), %edx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L17:
	cmpw	$25965, 4(%rbx)
	jne	.L9
	cmpb	$0, 6(%rbx)
	jne	.L9
	movl	20(%rsp), %edx
	addl	12(%rsp), %edx
.L6:
	movl	%edx, 12(%rsp)
	testl	%edx, %edx
	js	.L9
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jg	.L11
.L12:
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$48, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movl	12(%rsp), %edx
	jmp	.L12
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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	"%s"
.LC3:
	.string	"nobiro"
.LC4:
	.string	"tidime"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rcx
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	24(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebp, %ebp
	leaq	30(%rsp), %rbx
	leaq	.LC2(%rip), %r12
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L3:
	cmpl	$1768188276, (%rbx)
	je	.L17
.L9:
	movl	$0, 12(%rsp)
	xorl	%edx, %edx
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jle	.L12
.L11:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1768058734, (%rbx)
	jne	.L3
	cmpw	$28530, 4(%rbx)
	jne	.L3
	cmpb	$0, 6(%rbx)
	jne	.L3
	movl	16(%rsp), %edx
	addl	12(%rsp), %edx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L17:
	cmpw	$25965, 4(%rbx)
	jne	.L9
	cmpb	$0, 6(%rbx)
	jne	.L9
	movl	20(%rsp), %edx
	addl	12(%rsp), %edx
.L6:
	movl	%edx, 12(%rsp)
	testl	%edx, %edx
	js	.L9
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jg	.L11
.L12:
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$48, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movl	12(%rsp), %edx
	jmp	.L12
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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:
```