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

```c
/*
AizuOnline A0124
Title Baseball Championship
*/
#include <stdio.h>
// Select Below
#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
int n;

struct BTEAM
{
  char nam[21];
  int  order;  //input order
  int  win;
  int  draw;
  int  lose;
  int  katit;  //katiten
} team_info[10];
//
int team_compare (struct BTEAM * a,struct BTEAM * b)
{

  if(a->katit < b->katit)return(1);
  if(a->katit > b->katit)return(-1);
  if(a->order > b->order)return(1);
  if(a->order < b->order)return(-1);
  return(0);
}
main()
{
  int i,j,ss,flag;
  flag=0;
  while(1)
    {
      EOF!=scanf("%d",&n);
      if(n==0)break;
      if(flag)
	printf("\n");
      flag=1;
      for(i=0;i<n;i++)
	{
	  scanf("%s %d %d %d",
		team_info[i].nam,&team_info[i].win,
		&team_info[i].lose,&team_info[i].draw);
	  
	  team_info[i].katit =  team_info[i].win*3+team_info[i].draw;
	}
      qsort(team_info,n,sizeof(struct BTEAM ),(__compar_fn_t)team_compare);
      for(i=0;i<n;i++)
	{
          printf("%s,%d\n",team_info[i].nam,team_info[i].katit);
	}
    }
      return(0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	team_info
	.align 32
	.type	team_info, @object
	.size	team_info, 440
team_info:
	.zero	440
	.text
	.globl	team_compare
	.type	team_compare, @function
team_compare:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	40(%rax), %edx
	movq	-16(%rbp), %rax
	movl	40(%rax), %eax
	cmpl	%eax, %edx
	jge	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	movl	40(%rax), %edx
	movq	-16(%rbp), %rax
	movl	40(%rax), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movq	-8(%rbp), %rax
	movl	24(%rax), %edx
	movq	-16(%rbp), %rax
	movl	24(%rax), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	$1, %eax
	jmp	.L3
.L5:
	movq	-8(%rbp), %rax
	movl	24(%rax), %edx
	movq	-16(%rbp), %rax
	movl	24(%rax), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	$-1, %eax
	jmp	.L3
.L6:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	team_compare, .-team_compare
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d %d %d"
.LC2:
	.string	"%s,%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -4(%rbp)
.L15:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L18
	cmpl	$0, -4(%rbp)
	je	.L10
	movl	$10, %edi
	call	putchar@PLT
.L10:
	movl	$1, -4(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L11
.L12:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	32(%rax), %rdx
	leaq	team_info(%rip), %rax
	leaq	(%rdx,%rax), %rdi
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	32(%rax), %rdx
	leaq	team_info(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	16(%rax), %rdx
	leaq	team_info(%rip), %rax
	addq	%rdx, %rax
	leaq	12(%rax), %rsi
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	team_info(%rip), %rdx
	addq	%rdx, %rax
	movq	%rdi, %r8
	movq	%rsi, %rdx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	28+team_info(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	leal	(%rax,%rdx), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	32+team_info(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	40+team_info(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -8(%rbp)
.L11:
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L12
	movl	n(%rip), %eax
	cltq
	leaq	team_compare(%rip), %rdx
	movq	%rdx, %rcx
	movl	$44, %edx
	movq	%rax, %rsi
	leaq	team_info(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -8(%rbp)
	jmp	.L13
.L14:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	40+team_info(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	team_info(%rip), %rdx
	addq	%rdx, %rax
	movl	%ecx, %edx
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -8(%rbp)
.L13:
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L14
	jmp	.L15
.L18:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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
	.p2align 4
	.globl	team_compare
	.type	team_compare, @function
team_compare:
.LFB39:
	.cfi_startproc
	endbr64
	movl	40(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, 40(%rdi)
	jl	.L1
	movl	$-1, %eax
	jg	.L1
	movl	24(%rsi), %ecx
	movl	$1, %eax
	cmpl	%ecx, 24(%rdi)
	jg	.L1
	setl	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	team_compare, .-team_compare
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d %d %d"
.LC2:
	.string	"%s,%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
	leaq	n(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC2(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	n(%rip), %rsi
	testl	%esi, %esi
	je	.L8
	testl	%r12d, %r12d
	jne	.L23
.L9:
	testl	%esi, %esi
	jle	.L10
	leaq	28+team_info(%rip), %r12
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L11:
	leaq	-28(%r12), %rsi
	leaq	8(%r12), %rcx
	movq	%r12, %rdx
	movq	%rbp, %rdi
	leaq	4(%r12), %r8
	xorl	%eax, %eax
	addl	$1, %r15d
	addq	$44, %r12
	call	__isoc99_scanf@PLT
	movl	-44(%r12), %eax
	movslq	n(%rip), %rsi
	leal	(%rax,%rax,2), %eax
	addl	-40(%r12), %eax
	movl	%eax, -32(%r12)
	cmpl	%r15d, %esi
	jg	.L11
.L10:
	leaq	team_compare(%rip), %rcx
	movl	$44, %edx
	xorl	%r15d, %r15d
	leaq	team_info(%rip), %rdi
	leaq	team_info(%rip), %r12
	call	qsort@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movl	40(%r12), %ecx
	movq	%r12, %rdx
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movl	$1, %edi
	addl	$1, %r15d
	addq	$44, %r12
	call	__printf_chk@PLT
	cmpl	%r15d, n(%rip)
	jg	.L14
.L15:
	movl	$1, %r12d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L23:
	movl	$10, %edi
	call	putchar@PLT
	movslq	n(%rip), %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	addq	$8, %rsp
	.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
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	team_info
	.bss
	.align 32
	.type	team_info, @object
	.size	team_info, 440
team_info:
	.zero	440
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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
	.p2align 4
	.globl	team_compare
	.type	team_compare, @function
team_compare:
.LFB39:
	.cfi_startproc
	endbr64
	movl	40(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, 40(%rdi)
	jl	.L1
	movl	$-1, %eax
	jg	.L1
	movl	24(%rsi), %ecx
	movl	$1, %eax
	cmpl	%ecx, 24(%rdi)
	jg	.L1
	setl	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	team_compare, .-team_compare
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d %d %d"
.LC2:
	.string	"%s,%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
	leaq	n(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC2(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	n(%rip), %rsi
	testl	%esi, %esi
	je	.L8
	testl	%r12d, %r12d
	jne	.L23
.L9:
	testl	%esi, %esi
	jle	.L10
	leaq	28+team_info(%rip), %r12
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L11:
	leaq	-28(%r12), %rsi
	leaq	8(%r12), %rcx
	movq	%r12, %rdx
	movq	%rbp, %rdi
	leaq	4(%r12), %r8
	xorl	%eax, %eax
	addl	$1, %r15d
	addq	$44, %r12
	call	__isoc99_scanf@PLT
	movl	-44(%r12), %eax
	movslq	n(%rip), %rsi
	leal	(%rax,%rax,2), %eax
	addl	-40(%r12), %eax
	movl	%eax, -32(%r12)
	cmpl	%r15d, %esi
	jg	.L11
.L10:
	leaq	team_compare(%rip), %rcx
	movl	$44, %edx
	xorl	%r15d, %r15d
	leaq	team_info(%rip), %rdi
	leaq	team_info(%rip), %r12
	call	qsort@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movl	40(%r12), %ecx
	movq	%r12, %rdx
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movl	$1, %edi
	addl	$1, %r15d
	addq	$44, %r12
	call	__printf_chk@PLT
	cmpl	%r15d, n(%rip)
	jg	.L14
.L15:
	movl	$1, %r12d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L23:
	movl	$10, %edi
	call	putchar@PLT
	movslq	n(%rip), %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	addq	$8, %rsp
	.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
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	team_info
	.bss
	.align 32
	.type	team_info, @object
	.size	team_info, 440
team_info:
	.zero	440
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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:

/*
AizuOnline A0124
Title Baseball Championship
*/
#include <stdio.h>
// Select Below
#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
int n;

struct BTEAM
{
  char nam[21];
  int  order;  //input order
  int  win;
  int  draw;
  int  lose;
  int  katit;  //katiten
} team_info[10];
//
int team_compare (struct BTEAM * a,struct BTEAM * b)
{

  if(a->katit < b->katit)return(1);
  if(a->katit > b->katit)return(-1);
  if(a->order > b->order)return(1);
  if(a->order < b->order)return(-1);
  return(0);
}
main()
{
  int i,j,ss,flag;
  flag=0;
  while(1)
    {
      EOF!=scanf("%d",&n);
      if(n==0)break;
      if(flag)
	printf("\n");
      flag=1;
      for(i=0;i<n;i++)
	{
	  scanf("%s %d %d %d",
		team_info[i].nam,&team_info[i].win,
		&team_info[i].lose,&team_info[i].draw);
	  
	  team_info[i].katit =  team_info[i].win*3+team_info[i].draw;
	}
      qsort(team_info,n,sizeof(struct BTEAM ),(__compar_fn_t)team_compare);
      for(i=0;i<n;i++)
	{
          printf("%s,%d\n",team_info[i].nam,team_info[i].katit);
	}
    }
      return(0);
}
4
Japan 1 0 2
Egypt 1 2 0
Canada 0 2 1
Spain 2 0 1
3
India 0 2 0
Poland 1 0 1
Italy 1 -1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Canada 0 2 1
Spain 2 0 1
3
India 0 2 0
Poland 1 0 1
Italx 1 -1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Canada 0 2 1
niapS 2 0 1
3
India 0 2 0
Poland 1 0 1
Italy 1 1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Canada 0 2 1
Spain 2 0 1
3
India -1 2 0
Poland 1 0 1
Italx 1 -1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Caaadn 0 2 1
niapS 2 0 1
3
India 0 2 0
Poland 1 0 1
Italy 1 1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Canada 0 2 1
Spain 2 0 1
3
Jndia -1 2 0
Poland 1 0 1
Italx 1 -1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Caaadn 0 2 1
niapS 2 0 1
3
Iodia 0 2 0
Poland 1 0 1
Italy 1 1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Canada 0 2 1
Spain 1 0 1
3
Jndia -1 2 0
Poland 1 0 1
Italx 1 -1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Caaadn 0 2 1
niapS 2 0 1
3
Ioida 0 2 0
Poland 1 0 1
Italy 1 1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Caaadn 0 2 1
nibpS 2 0 1
3
Ioida 0 2 0
Poland 1 0 1
Italy 1 1 1
0

Spain,7
Japan,5
Egypt,3
Canada,1

Poland,4
Italy,4
India,0
 Spain,7
Japan,5
Egypt,3
Canada,1

Poland,4
Italx,4
India,0
 niapS,7
Japan,5
Egypt,3
Canada,1

Poland,4
Italy,4
India,0
 Spain,7
Japan,5
Egypt,3
Canada,1

Poland,4
Italx,4
India,-3
 niapS,7
Japan,5
Egypt,3
Caaadn,1

Poland,4
Italy,4
India,0
 Spain,7
Japan,5
Egypt,3
Canada,1

Poland,4
Italx,4
Jndia,-3
 niapS,7
Japan,5
Egypt,3
Caaadn,1

Poland,4
Italy,4
Iodia,0
 Japan,5
Spain,4
Egypt,3
Canada,1

Poland,4
Italx,4
Jndia,-3
 niapS,7
Japan,5
Egypt,3
Caaadn,1

Poland,4
Italy,4
Ioida,0
 nibpS,7
Japan,5
Egypt,3
Caaadn,1

Poland,4
Italy,4
Ioida,0

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

```c
/*
AizuOnline A0124
Title Baseball Championship
*/
#include <stdio.h>
// Select Below
#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
int n;

struct BTEAM
{
  char nam[21];
  int  order;  //input order
  int  win;
  int  draw;
  int  lose;
  int  katit;  //katiten
} team_info[10];
//
int team_compare (struct BTEAM * a,struct BTEAM * b)
{

  if(a->katit < b->katit)return(1);
  if(a->katit > b->katit)return(-1);
  if(a->order > b->order)return(1);
  if(a->order < b->order)return(-1);
  return(0);
}
main()
{
  int i,j,ss,flag;
  flag=0;
  while(1)
    {
      EOF!=scanf("%d",&n);
      if(n==0)break;
      if(flag)
	printf("\n");
      flag=1;
      for(i=0;i<n;i++)
	{
	  scanf("%s %d %d %d",
		team_info[i].nam,&team_info[i].win,
		&team_info[i].lose,&team_info[i].draw);
	  
	  team_info[i].katit =  team_info[i].win*3+team_info[i].draw;
	}
      qsort(team_info,n,sizeof(struct BTEAM ),(__compar_fn_t)team_compare);
      for(i=0;i<n;i++)
	{
          printf("%s,%d\n",team_info[i].nam,team_info[i].katit);
	}
    }
      return(0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	team_info
	.align 32
	.type	team_info, @object
	.size	team_info, 440
team_info:
	.zero	440
	.text
	.globl	team_compare
	.type	team_compare, @function
team_compare:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	40(%rax), %edx
	movq	-16(%rbp), %rax
	movl	40(%rax), %eax
	cmpl	%eax, %edx
	jge	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	movl	40(%rax), %edx
	movq	-16(%rbp), %rax
	movl	40(%rax), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movq	-8(%rbp), %rax
	movl	24(%rax), %edx
	movq	-16(%rbp), %rax
	movl	24(%rax), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	$1, %eax
	jmp	.L3
.L5:
	movq	-8(%rbp), %rax
	movl	24(%rax), %edx
	movq	-16(%rbp), %rax
	movl	24(%rax), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	$-1, %eax
	jmp	.L3
.L6:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	team_compare, .-team_compare
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d %d %d"
.LC2:
	.string	"%s,%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -4(%rbp)
.L15:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L18
	cmpl	$0, -4(%rbp)
	je	.L10
	movl	$10, %edi
	call	putchar@PLT
.L10:
	movl	$1, -4(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L11
.L12:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	32(%rax), %rdx
	leaq	team_info(%rip), %rax
	leaq	(%rdx,%rax), %rdi
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	32(%rax), %rdx
	leaq	team_info(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	16(%rax), %rdx
	leaq	team_info(%rip), %rax
	addq	%rdx, %rax
	leaq	12(%rax), %rsi
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	team_info(%rip), %rdx
	addq	%rdx, %rax
	movq	%rdi, %r8
	movq	%rsi, %rdx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	28+team_info(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	leal	(%rax,%rdx), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	32+team_info(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	40+team_info(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -8(%rbp)
.L11:
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L12
	movl	n(%rip), %eax
	cltq
	leaq	team_compare(%rip), %rdx
	movq	%rdx, %rcx
	movl	$44, %edx
	movq	%rax, %rsi
	leaq	team_info(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -8(%rbp)
	jmp	.L13
.L14:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	40+team_info(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	team_info(%rip), %rdx
	addq	%rdx, %rax
	movl	%ecx, %edx
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -8(%rbp)
.L13:
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L14
	jmp	.L15
.L18:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	team_info
	.align 32
	.type	team_info, @object
	.size	team_info, 440
team_info:
	.zero	440
	.text
	.globl	team_compare
	.type	team_compare, @function
team_compare:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	40(%rax), %edx
	movq	-16(%rbp), %rax
	movl	40(%rax), %eax
	cmpl	%eax, %edx
	jge	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	movl	40(%rax), %edx
	movq	-16(%rbp), %rax
	movl	40(%rax), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movq	-8(%rbp), %rax
	movl	24(%rax), %edx
	movq	-16(%rbp), %rax
	movl	24(%rax), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	$1, %eax
	jmp	.L3
.L5:
	movq	-8(%rbp), %rax
	movl	24(%rax), %edx
	movq	-16(%rbp), %rax
	movl	24(%rax), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	$-1, %eax
	jmp	.L3
.L6:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	team_compare, .-team_compare
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d %d %d"
.LC2:
	.string	"%s,%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -4(%rbp)
.L15:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L18
	cmpl	$0, -4(%rbp)
	je	.L10
	movl	$10, %edi
	call	putchar@PLT
.L10:
	movl	$1, -4(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L11
.L12:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	32(%rax), %rdx
	leaq	team_info(%rip), %rax
	leaq	(%rdx,%rax), %rdi
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	32(%rax), %rdx
	leaq	team_info(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	16(%rax), %rdx
	leaq	team_info(%rip), %rax
	addq	%rdx, %rax
	leaq	12(%rax), %rsi
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	team_info(%rip), %rdx
	addq	%rdx, %rax
	movq	%rdi, %r8
	movq	%rsi, %rdx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	28+team_info(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	leal	(%rax,%rdx), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	32+team_info(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	40+team_info(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -8(%rbp)
.L11:
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L12
	movl	n(%rip), %eax
	cltq
	leaq	team_compare(%rip), %rdx
	movq	%rdx, %rcx
	movl	$44, %edx
	movq	%rax, %rsi
	leaq	team_info(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -8(%rbp)
	jmp	.L13
.L14:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	40+team_info(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	team_info(%rip), %rdx
	addq	%rdx, %rax
	movl	%ecx, %edx
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -8(%rbp)
.L13:
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L14
	jmp	.L15
.L18:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
