Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
//#define pi acos(-1.0)
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
#define S(type,x) fscanf(stdin,"%"#type,&x)
int main() {
	int vote[26],n;
	char a,tmp;
	while (S(d, n), n) {
		getchar();
		int max, sec,i;
		max = sec = i = 0;
		tmp = 'A';
		memset(vote, 0, sizeof(vote));
		while (n--) {
			fscanf(stdin, "%c%*c", &a);
			if (max > sec + n+1)continue;
			i++;
			vote[a - 'A']++;
			if (vote[a - 'A'] >= max) {
				if(vote[tmp-'A']-1!=max) sec = max;
				max = vote[a - 'A'], tmp = a;
			}
			else if (vote[a - 'A'] > sec) sec = vote[a - 'A'];
		}
		if (max == sec) puts("TIE");
		else fprintf(stdout, "%c %d\n", tmp, i);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%c%*c"
.LC1:
	.string	"TIE"
.LC2:
	.string	"%c %d\n"
.LC3:
	.string	"%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	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L9:
	call	getchar@PLT
	movl	$0, -116(%rbp)
	movl	-116(%rbp), %eax
	movl	%eax, -120(%rbp)
	movl	-120(%rbp), %eax
	movl	%eax, -124(%rbp)
	movb	$65, -129(%rbp)
	leaq	-112(%rbp), %rax
	movl	$104, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	jmp	.L3
.L7:
	movq	stdin(%rip), %rax
	leaq	-130(%rbp), %rdx
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-128(%rbp), %edx
	movl	-120(%rbp), %eax
	addl	%edx, %eax
	addl	$1, %eax
	cmpl	%eax, -124(%rbp)
	jle	.L4
	jmp	.L3
.L4:
	addl	$1, -116(%rbp)
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	movslq	%eax, %rdx
	movl	-112(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -112(%rbp,%rax,4)
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	cmpl	%eax, -124(%rbp)
	jg	.L5
	movsbl	-129(%rbp), %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	subl	$1, %eax
	cmpl	%eax, -124(%rbp)
	je	.L6
	movl	-124(%rbp), %eax
	movl	%eax, -120(%rbp)
.L6:
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	movl	%eax, -124(%rbp)
	movzbl	-130(%rbp), %eax
	movb	%al, -129(%rbp)
	jmp	.L3
.L5:
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	cmpl	%eax, -120(%rbp)
	jge	.L3
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	movl	%eax, -120(%rbp)
.L3:
	movl	-128(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -128(%rbp)
	testl	%eax, %eax
	jne	.L7
	movl	-124(%rbp), %eax
	cmpl	-120(%rbp), %eax
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L8:
	movsbl	-129(%rbp), %edx
	movq	stdout(%rip), %rax
	movl	-116(%rbp), %ecx
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	fprintf@PLT
.L2:
	movq	stdin(%rip), %rax
	leaq	-128(%rbp), %rdx
	leaq	.LC3(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-128(%rbp), %eax
	testl	%eax, %eax
	jne	.L9
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	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	"%c%*c"
.LC1:
	.string	"TIE"
.LC2:
	.string	"%c %d\n"
.LC3:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$152, %rsp
	.cfi_def_cfa_offset 208
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	leaq	28(%rsp), %r14
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	stdin(%rip), %rdi
	movq	%r14, %rdx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	call	__isoc99_fscanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L16
	movq	stdin(%rip), %rdi
	xorl	%ebp, %ebp
	xorl	%r15d, %r15d
	xorl	%r13d, %r13d
	movl	$65, %ebx
	call	getc@PLT
	movq	8(%rsp), %rdi
	xorl	%eax, %eax
	movl	28(%rsp), %edx
	movl	$13, %ecx
	rep stosq
	.p2align 4,,10
	.p2align 3
.L4:
	leal	-1(%rdx), %eax
	movl	%eax, 28(%rsp)
	testl	%edx, %edx
	je	.L17
.L7:
	movq	stdin(%rip), %rdi
	leaq	27(%rsp), %rdx
	movq	%r12, %rsi
	xorl	%eax, %eax
	call	__isoc99_fscanf@PLT
	movl	28(%rsp), %edx
	leal	1(%r15,%rdx), %eax
	cmpl	%r13d, %eax
	jl	.L4
	movsbl	27(%rsp), %eax
	addl	$1, %ebp
	movl	%eax, %edi
	subl	$65, %eax
	cltq
	movl	32(%rsp,%rax,4), %ecx
	leal	1(%rcx), %esi
	movl	%esi, 32(%rsp,%rax,4)
	cmpl	%r13d, %esi
	jl	.L5
	subl	$65, %ebx
	movslq	%ebx, %rbx
	movl	32(%rsp,%rbx,4), %eax
	subl	$1, %eax
	cmpl	%eax, %r13d
	je	.L12
	leal	-1(%rdx), %eax
	movl	%r13d, %r15d
	movsbl	%dil, %ebx
	movl	%esi, %r13d
	movl	%eax, 28(%rsp)
	testl	%edx, %edx
	jne	.L7
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	%r15d, %r13d
	je	.L18
	movq	stdout(%rip), %rdi
	movsbl	%bl, %ecx
	movl	%ebp, %r8d
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdx
	movl	$1, %esi
	call	__fprintf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	cmpl	%esi, %r15d
	cmovl	%esi, %r15d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L12:
	movl	%esi, %r13d
	movsbl	%dil, %ebx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L16:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$152, %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
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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	"%c%*c"
.LC1:
	.string	"TIE"
.LC2:
	.string	"%c %d\n"
.LC3:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$152, %rsp
	.cfi_def_cfa_offset 208
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	leaq	28(%rsp), %r14
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	stdin(%rip), %rdi
	movq	%r14, %rdx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	call	__isoc99_fscanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L16
	movq	stdin(%rip), %rdi
	xorl	%ebp, %ebp
	xorl	%r15d, %r15d
	xorl	%r13d, %r13d
	movl	$65, %ebx
	call	getc@PLT
	movq	8(%rsp), %rdi
	xorl	%eax, %eax
	movl	28(%rsp), %edx
	movl	$13, %ecx
	rep stosq
	.p2align 4,,10
	.p2align 3
.L4:
	leal	-1(%rdx), %eax
	movl	%eax, 28(%rsp)
	testl	%edx, %edx
	je	.L17
.L7:
	movq	stdin(%rip), %rdi
	leaq	27(%rsp), %rdx
	movq	%r12, %rsi
	xorl	%eax, %eax
	call	__isoc99_fscanf@PLT
	movl	28(%rsp), %edx
	leal	1(%r15,%rdx), %eax
	cmpl	%r13d, %eax
	jl	.L4
	movsbl	27(%rsp), %eax
	addl	$1, %ebp
	movl	%eax, %edi
	subl	$65, %eax
	cltq
	movl	32(%rsp,%rax,4), %ecx
	leal	1(%rcx), %esi
	movl	%esi, 32(%rsp,%rax,4)
	cmpl	%r13d, %esi
	jl	.L5
	subl	$65, %ebx
	movslq	%ebx, %rbx
	movl	32(%rsp,%rbx,4), %eax
	subl	$1, %eax
	cmpl	%eax, %r13d
	je	.L12
	leal	-1(%rdx), %eax
	movl	%r13d, %r15d
	movsbl	%dil, %ebx
	movl	%esi, %r13d
	movl	%eax, 28(%rsp)
	testl	%edx, %edx
	jne	.L7
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	%r15d, %r13d
	je	.L18
	movq	stdout(%rip), %rdi
	movsbl	%bl, %ecx
	movl	%ebp, %r8d
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdx
	movl	$1, %esi
	call	__fprintf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	cmpl	%esi, %r15d
	cmovl	%esi, %r15d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L12:
	movl	%esi, %r13d
	movsbl	%dil, %ebx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L16:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$152, %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
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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:

#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
//#define pi acos(-1.0)
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
#define S(type,x) fscanf(stdin,"%"#type,&x)
int main() {
	int vote[26],n;
	char a,tmp;
	while (S(d, n), n) {
		getchar();
		int max, sec,i;
		max = sec = i = 0;
		tmp = 'A';
		memset(vote, 0, sizeof(vote));
		while (n--) {
			fscanf(stdin, "%c%*c", &a);
			if (max > sec + n+1)continue;
			i++;
			vote[a - 'A']++;
			if (vote[a - 'A'] >= max) {
				if(vote[tmp-'A']-1!=max) sec = max;
				max = vote[a - 'A'], tmp = a;
			}
			else if (vote[a - 'A'] > sec) sec = vote[a - 'A'];
		}
		if (max == sec) puts("TIE");
		else fprintf(stdout, "%c %d\n", tmp, i);
	}
	return 0;
}
1
A
4
A A B B
5
L M N L N
6
K K K K K K
6
X X X Y Z X
10
A A A B A C A C C B
10
V U U U U V V W W W
0
 1
A
4
A A B B
5
L M N L N
6
K K K K K K
6
X X X Y Z X
10
A A A B A C A C C B
10
V U U U U V V W V W
0
 1
A
4
A A B B
5
L M N L N
6
K K K K K K
6
X X X Y Z X
10
B A A B A C A C C B
10
V U U U U V V W V W
0
 1
A
4
A A B B
5
L M N L N
6
K K K K K K
6
X X X Y Z X
10
B A A B A C A C C B
10
V U U U U W V W V W
0
 1
A
4
A A B B
5
L M N L N
6
K K K K K K
6
X X X Y Z X
10
B A A B A B A C C B
10
V U U U U W V W V W
0
 1
A
4
A A B B
5
L M N L N
6
K J K K K K
6
X X X Y Z X
10
A A A B A C A C C B
10
V U U U U V V W W W
0

A 1
TIE
TIE
K 4
X 5
A 7
U 10
 A 1
TIE
TIE
K 4
X 5
A 7
TIE
 A 1
TIE
TIE
K 4
X 5
A 10
TIE
 A 1
TIE
TIE
K 4
X 5
A 10
U 10
 A 1
TIE
TIE
K 4
X 5
TIE
U 10
 A 1
TIE
TIE
K 5
X 5
A 7
U 10

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
//#define pi acos(-1.0)
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
#define S(type,x) fscanf(stdin,"%"#type,&x)
int main() {
	int vote[26],n;
	char a,tmp;
	while (S(d, n), n) {
		getchar();
		int max, sec,i;
		max = sec = i = 0;
		tmp = 'A';
		memset(vote, 0, sizeof(vote));
		while (n--) {
			fscanf(stdin, "%c%*c", &a);
			if (max > sec + n+1)continue;
			i++;
			vote[a - 'A']++;
			if (vote[a - 'A'] >= max) {
				if(vote[tmp-'A']-1!=max) sec = max;
				max = vote[a - 'A'], tmp = a;
			}
			else if (vote[a - 'A'] > sec) sec = vote[a - 'A'];
		}
		if (max == sec) puts("TIE");
		else fprintf(stdout, "%c %d\n", tmp, i);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%c%*c"
.LC1:
	.string	"TIE"
.LC2:
	.string	"%c %d\n"
.LC3:
	.string	"%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	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L9:
	call	getchar@PLT
	movl	$0, -116(%rbp)
	movl	-116(%rbp), %eax
	movl	%eax, -120(%rbp)
	movl	-120(%rbp), %eax
	movl	%eax, -124(%rbp)
	movb	$65, -129(%rbp)
	leaq	-112(%rbp), %rax
	movl	$104, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	jmp	.L3
.L7:
	movq	stdin(%rip), %rax
	leaq	-130(%rbp), %rdx
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-128(%rbp), %edx
	movl	-120(%rbp), %eax
	addl	%edx, %eax
	addl	$1, %eax
	cmpl	%eax, -124(%rbp)
	jle	.L4
	jmp	.L3
.L4:
	addl	$1, -116(%rbp)
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	movslq	%eax, %rdx
	movl	-112(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -112(%rbp,%rax,4)
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	cmpl	%eax, -124(%rbp)
	jg	.L5
	movsbl	-129(%rbp), %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	subl	$1, %eax
	cmpl	%eax, -124(%rbp)
	je	.L6
	movl	-124(%rbp), %eax
	movl	%eax, -120(%rbp)
.L6:
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	movl	%eax, -124(%rbp)
	movzbl	-130(%rbp), %eax
	movb	%al, -129(%rbp)
	jmp	.L3
.L5:
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	cmpl	%eax, -120(%rbp)
	jge	.L3
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	movl	%eax, -120(%rbp)
.L3:
	movl	-128(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -128(%rbp)
	testl	%eax, %eax
	jne	.L7
	movl	-124(%rbp), %eax
	cmpl	-120(%rbp), %eax
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L8:
	movsbl	-129(%rbp), %edx
	movq	stdout(%rip), %rax
	movl	-116(%rbp), %ecx
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	fprintf@PLT
.L2:
	movq	stdin(%rip), %rax
	leaq	-128(%rbp), %rdx
	leaq	.LC3(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-128(%rbp), %eax
	testl	%eax, %eax
	jne	.L9
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	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	"%c%*c"
.LC1:
	.string	"TIE"
.LC2:
	.string	"%c %d\n"
.LC3:
	.string	"%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	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L9:
	call	getchar@PLT
	movl	$0, -116(%rbp)
	movl	-116(%rbp), %eax
	movl	%eax, -120(%rbp)
	movl	-120(%rbp), %eax
	movl	%eax, -124(%rbp)
	movb	$65, -129(%rbp)
	leaq	-112(%rbp), %rax
	movl	$104, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	jmp	.L3
.L7:
	movq	stdin(%rip), %rax
	leaq	-130(%rbp), %rdx
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-128(%rbp), %edx
	movl	-120(%rbp), %eax
	addl	%edx, %eax
	addl	$1, %eax
	cmpl	%eax, -124(%rbp)
	jle	.L4
	jmp	.L3
.L4:
	addl	$1, -116(%rbp)
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	movslq	%eax, %rdx
	movl	-112(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -112(%rbp,%rax,4)
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	cmpl	%eax, -124(%rbp)
	jg	.L5
	movsbl	-129(%rbp), %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	subl	$1, %eax
	cmpl	%eax, -124(%rbp)
	je	.L6
	movl	-124(%rbp), %eax
	movl	%eax, -120(%rbp)
.L6:
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	movl	%eax, -124(%rbp)
	movzbl	-130(%rbp), %eax
	movb	%al, -129(%rbp)
	jmp	.L3
.L5:
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	cmpl	%eax, -120(%rbp)
	jge	.L3
	movzbl	-130(%rbp), %eax
	movsbl	%al, %eax
	subl	$65, %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	movl	%eax, -120(%rbp)
.L3:
	movl	-128(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -128(%rbp)
	testl	%eax, %eax
	jne	.L7
	movl	-124(%rbp), %eax
	cmpl	-120(%rbp), %eax
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L8:
	movsbl	-129(%rbp), %edx
	movq	stdout(%rip), %rax
	movl	-116(%rbp), %ecx
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	fprintf@PLT
.L2:
	movq	stdin(%rip), %rax
	leaq	-128(%rbp), %rdx
	leaq	.LC3(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-128(%rbp), %eax
	testl	%eax, %eax
	jne	.L9
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	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:
