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

typedef struct {
	int input_id;
	char name[4];
	int win;
	int lose;
} team_t;

int qsort_comp(const void* x,const void* y) {
	const team_t* a=(const team_t*)x;
	const team_t* b=(const team_t*)y;
	if((a->win)<(b->win))return 1;
	if((a->win)>(b->win))return -1;
	if((a->lose)>(b->lose))return 1;
	if((a->lose)<(b->lose))return -1;
	if((a->input_id)>(b->input_id))return 1;
	if((a->input_id)<(b->input_id))return -1;
	return 0;
}

int main(void) {
	int team_num;
	team_t teams[10];
	int seiseki;
	int i,j;
	while(1) {
		scanf("%d",&team_num);
		if(team_num==0)break;
		for(i=0;i<team_num;i++) {
			teams[i].input_id=i;
			scanf("%s",teams[i].name);
			teams[i].win=teams[i].lose=0;
			for(j=1;j<team_num;j++) {
				scanf("%d",&seiseki);
				if(seiseki==0)teams[i].win++;
				else if(seiseki==1)teams[i].lose++;
			}
		}
		qsort(teams,team_num,sizeof(team_t),qsort_comp);
		for(i=0;i<team_num;i++)puts(teams[i].name);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	qsort_comp
	.type	qsort_comp, @function
qsort_comp:
.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, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	8(%rax), %edx
	movq	-8(%rbp), %rax
	movl	8(%rax), %eax
	cmpl	%eax, %edx
	jge	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-16(%rbp), %rax
	movl	8(%rax), %edx
	movq	-8(%rbp), %rax
	movl	8(%rax), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movq	-16(%rbp), %rax
	movl	12(%rax), %edx
	movq	-8(%rbp), %rax
	movl	12(%rax), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	$1, %eax
	jmp	.L3
.L5:
	movq	-16(%rbp), %rax
	movl	12(%rax), %edx
	movq	-8(%rbp), %rax
	movl	12(%rax), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	$-1, %eax
	jmp	.L3
.L6:
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L7
	movl	$1, %eax
	jmp	.L3
.L7:
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L8
	movl	$-1, %eax
	jmp	.L3
.L8:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	qsort_comp, .-qsort_comp
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.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	$192, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L20:
	leaq	-192(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-192(%rbp), %eax
	testl	%eax, %eax
	je	.L24
	movl	$0, -184(%rbp)
	jmp	.L12
.L17:
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	leaq	-176(%rax), %rdx
	movl	-184(%rbp), %eax
	movl	%eax, (%rdx)
	leaq	-176(%rbp), %rdx
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdx, %rax
	addq	$4, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$164, %rax
	movl	$0, (%rax)
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$164, %rax
	movl	(%rax), %eax
	movl	-184(%rbp), %edx
	movslq	%edx, %rdx
	salq	$4, %rdx
	addq	%rbp, %rdx
	subq	$168, %rdx
	movl	%eax, (%rdx)
	movl	$1, -180(%rbp)
	jmp	.L13
.L16:
	leaq	-188(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-188(%rbp), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$168, %rax
	movl	(%rax), %eax
	leal	1(%rax), %edx
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$168, %rax
	movl	%edx, (%rax)
	jmp	.L15
.L14:
	movl	-188(%rbp), %eax
	cmpl	$1, %eax
	jne	.L15
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$164, %rax
	movl	(%rax), %eax
	leal	1(%rax), %edx
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$164, %rax
	movl	%edx, (%rax)
.L15:
	addl	$1, -180(%rbp)
.L13:
	movl	-192(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jl	.L16
	addl	$1, -184(%rbp)
.L12:
	movl	-192(%rbp), %eax
	cmpl	%eax, -184(%rbp)
	jl	.L17
	movl	-192(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-176(%rbp), %rax
	leaq	qsort_comp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -184(%rbp)
	jmp	.L18
.L19:
	leaq	-176(%rbp), %rdx
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdx, %rax
	addq	$4, %rax
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -184(%rbp)
.L18:
	movl	-192(%rbp), %eax
	cmpl	%eax, -184(%rbp)
	jl	.L19
	jmp	.L20
.L24:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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	qsort_comp
	.type	qsort_comp, @function
qsort_comp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	8(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, 8(%rdi)
	jl	.L1
	movl	$-1, %eax
	jg	.L1
	movl	12(%rsi), %ecx
	movl	$1, %eax
	cmpl	%ecx, 12(%rdi)
	jg	.L1
	movl	$-1, %eax
	jl	.L1
	movl	(%rsi), %ecx
	movl	$1, %eax
	cmpl	%ecx, (%rdi)
	jg	.L1
	setl	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	qsort_comp, .-qsort_comp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.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	.LC1(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$216, %rsp
	.cfi_def_cfa_offset 272
	movq	%fs:40, %rax
	movq	%rax, 200(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	leaq	28(%rsp), %r12
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L18:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	je	.L10
	jle	.L11
	leaq	36(%rsp), %rbx
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%r13d, -4(%rbx)
	movq	%rbx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	movq	$0, 4(%rbx)
	cmpl	$1, %eax
	jle	.L11
	movl	$1, %r15d
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L28:
	addl	$1, 4(%rbx)
.L14:
	movl	24(%rsp), %eax
	addl	$1, %r15d
	cmpl	%r15d, %eax
	jle	.L27
.L15:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L28
	cmpl	$1, %eax
	jne	.L14
	movl	24(%rsp), %eax
	addl	$1, %r15d
	addl	$1, 8(%rbx)
	cmpl	%r15d, %eax
	jg	.L15
	.p2align 4,,10
	.p2align 3
.L27:
	addl	$1, %r13d
	addq	$16, %rbx
	cmpl	%r13d, %eax
	jg	.L16
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	%eax, %rsi
	leaq	32(%rsp), %rdi
	movl	$16, %edx
	xorl	%ebx, %ebx
	leaq	qsort_comp(%rip), %rcx
	leaq	36(%rsp), %r13
	call	qsort@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L18
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%r13, %rdi
	addl	$1, %ebx
	addq	$16, %r13
	call	puts@PLT
	cmpl	%ebx, 24(%rsp)
	jg	.L19
	jmp	.L18
.L10:
	movq	200(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L29
	addq	$216, %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
.L29:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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
	.p2align 4
	.globl	qsort_comp
	.type	qsort_comp, @function
qsort_comp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	8(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, 8(%rdi)
	jl	.L1
	movl	$-1, %eax
	jg	.L1
	movl	12(%rsi), %ecx
	movl	$1, %eax
	cmpl	%ecx, 12(%rdi)
	jg	.L1
	movl	$-1, %eax
	jl	.L1
	movl	(%rsi), %ecx
	movl	$1, %eax
	cmpl	%ecx, (%rdi)
	jg	.L1
	setl	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	qsort_comp, .-qsort_comp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.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	.LC1(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$216, %rsp
	.cfi_def_cfa_offset 272
	movq	%fs:40, %rax
	movq	%rax, 200(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	leaq	28(%rsp), %r12
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L18:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	je	.L10
	jle	.L11
	leaq	36(%rsp), %rbx
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%r13d, -4(%rbx)
	movq	%rbx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	movq	$0, 4(%rbx)
	cmpl	$1, %eax
	jle	.L11
	movl	$1, %r15d
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L28:
	addl	$1, 4(%rbx)
.L14:
	movl	24(%rsp), %eax
	addl	$1, %r15d
	cmpl	%r15d, %eax
	jle	.L27
.L15:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L28
	cmpl	$1, %eax
	jne	.L14
	movl	24(%rsp), %eax
	addl	$1, %r15d
	addl	$1, 8(%rbx)
	cmpl	%r15d, %eax
	jg	.L15
	.p2align 4,,10
	.p2align 3
.L27:
	addl	$1, %r13d
	addq	$16, %rbx
	cmpl	%r13d, %eax
	jg	.L16
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	%eax, %rsi
	leaq	32(%rsp), %rdi
	movl	$16, %edx
	xorl	%ebx, %ebx
	leaq	qsort_comp(%rip), %rcx
	leaq	36(%rsp), %r13
	call	qsort@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L18
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%r13, %rdi
	addl	$1, %ebx
	addq	$16, %r13
	call	puts@PLT
	cmpl	%ebx, 24(%rsp)
	jg	.L19
	jmp	.L18
.L10:
	movq	200(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L29
	addq	$216, %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
.L29:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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>
#include <stdlib.h>

typedef struct {
	int input_id;
	char name[4];
	int win;
	int lose;
} team_t;

int qsort_comp(const void* x,const void* y) {
	const team_t* a=(const team_t*)x;
	const team_t* b=(const team_t*)y;
	if((a->win)<(b->win))return 1;
	if((a->win)>(b->win))return -1;
	if((a->lose)>(b->lose))return 1;
	if((a->lose)<(b->lose))return -1;
	if((a->input_id)>(b->input_id))return 1;
	if((a->input_id)<(b->input_id))return -1;
	return 0;
}

int main(void) {
	int team_num;
	team_t teams[10];
	int seiseki;
	int i,j;
	while(1) {
		scanf("%d",&team_num);
		if(team_num==0)break;
		for(i=0;i<team_num;i++) {
			teams[i].input_id=i;
			scanf("%s",teams[i].name);
			teams[i].win=teams[i].lose=0;
			for(j=1;j<team_num;j++) {
				scanf("%d",&seiseki);
				if(seiseki==0)teams[i].win++;
				else if(seiseki==1)teams[i].lose++;
			}
		}
		qsort(teams,team_num,sizeof(team_t),qsort_comp);
		for(i=0;i<team_num;i++)puts(teams[i].name);
	}
	return 0;
}
6
A 1 0 0 2 0
B 0 0 1 1 0
C 1 1 1 1 1
D 1 0 0 1 2
E 2 0 0 0 0
F 1 1 0 2 1
4
g 1 1 1
h 0 1 2
x 0 0 0
b 0 2 1
0
 6
A 1 0 0 2 -1
B 0 0 1 1 0
C 1 1 1 1 1
D 1 0 0 1 2
E 2 0 0 0 0
F 1 1 0 2 1
4
g 1 1 1
h 0 1 2
x 0 0 0
b 0 2 1
0
 6
A 1 0 0 2 -1
B 0 0 1 1 0
C 1 1 1 1 1
D 1 0 0 0 2
E 2 0 0 0 0
F 1 1 0 2 1
4
g 1 1 1
h 0 1 2
x 0 0 0
b 0 2 1
0
 6
A 1 0 0 2 -1
B 0 0 1 1 0
C 1 1 1 1 1
D 1 0 0 0 2
E 2 0 0 0 0
F 1 1 0 2 1
4
g 1 1 1
h 0 1 2
x 0 0 0
b 0 2 2
0
 6
A 1 0 0 2 -1
B 0 0 1 1 0
C 1 1 1 1 1
D 1 0 0 0 2
E 2 0 0 0 0
F 1 1 0 2 1
4
g 1 1 1
g 0 1 2
x 0 0 0
b 0 2 2
0
 6
A 1 0 0 2 -1
B 0 0 1 1 0
C 1 1 1 1 1
D 1 0 0 0 2
E 2 0 0 0 0
F 1 1 0 2 2
4
g 1 1 1
g 0 1 0
x 0 0 0
b 0 2 2
0
 6
A 1 0 0 2 0
B 0 0 1 1 0
C 1 1 1 1 1
D 1 0 0 1 2
E 2 0 0 0 0
F 1 1 0 2 1
4
g 1 1 1
g 0 1 2
x 0 0 0
b 0 2 1
0
 6
A 1 0 0 2 -1
B 1 0 1 1 0
C 1 1 1 1 1
D 1 0 0 0 2
E 2 0 0 0 0
F 1 1 0 2 1
4
g 1 1 1
h 0 1 2
x 0 0 0
b 0 2 1
0
 6
A 1 0 0 2 -1
B 0 0 1 1 0
C 1 1 1 1 1
D 1 0 0 0 2
E 2 0 0 0 0
F 1 1 0 2 1
4
h 1 1 1
g 0 1 2
x 0 0 0
b 0 2 2
0
 6
A 1 0 0 2 0
C 0 0 1 1 0
C 1 1 1 1 1
D 1 0 0 1 2
E 2 0 0 0 0
F 1 1 0 2 1
4
g 1 1 1
g 0 1 2
x 0 0 0
b 0 2 1
0

E
A
B
D
F
C
x
h
b
g
 E
B
A
D
F
C
x
h
b
g
 E
D
B
A
F
C
x
h
b
g
 E
D
B
A
F
C
x
b
h
g
 E
D
B
A
F
C
x
b
g
g
 E
D
B
A
F
C
x
g
b
g
 E
A
B
D
F
C
x
g
b
g
 E
D
A
B
F
C
x
h
b
g
 E
D
B
A
F
C
x
b
g
h
 E
A
C
D
F
C
x
g
b
g

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

typedef struct {
	int input_id;
	char name[4];
	int win;
	int lose;
} team_t;

int qsort_comp(const void* x,const void* y) {
	const team_t* a=(const team_t*)x;
	const team_t* b=(const team_t*)y;
	if((a->win)<(b->win))return 1;
	if((a->win)>(b->win))return -1;
	if((a->lose)>(b->lose))return 1;
	if((a->lose)<(b->lose))return -1;
	if((a->input_id)>(b->input_id))return 1;
	if((a->input_id)<(b->input_id))return -1;
	return 0;
}

int main(void) {
	int team_num;
	team_t teams[10];
	int seiseki;
	int i,j;
	while(1) {
		scanf("%d",&team_num);
		if(team_num==0)break;
		for(i=0;i<team_num;i++) {
			teams[i].input_id=i;
			scanf("%s",teams[i].name);
			teams[i].win=teams[i].lose=0;
			for(j=1;j<team_num;j++) {
				scanf("%d",&seiseki);
				if(seiseki==0)teams[i].win++;
				else if(seiseki==1)teams[i].lose++;
			}
		}
		qsort(teams,team_num,sizeof(team_t),qsort_comp);
		for(i=0;i<team_num;i++)puts(teams[i].name);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	qsort_comp
	.type	qsort_comp, @function
qsort_comp:
.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, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	8(%rax), %edx
	movq	-8(%rbp), %rax
	movl	8(%rax), %eax
	cmpl	%eax, %edx
	jge	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-16(%rbp), %rax
	movl	8(%rax), %edx
	movq	-8(%rbp), %rax
	movl	8(%rax), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movq	-16(%rbp), %rax
	movl	12(%rax), %edx
	movq	-8(%rbp), %rax
	movl	12(%rax), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	$1, %eax
	jmp	.L3
.L5:
	movq	-16(%rbp), %rax
	movl	12(%rax), %edx
	movq	-8(%rbp), %rax
	movl	12(%rax), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	$-1, %eax
	jmp	.L3
.L6:
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L7
	movl	$1, %eax
	jmp	.L3
.L7:
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L8
	movl	$-1, %eax
	jmp	.L3
.L8:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	qsort_comp, .-qsort_comp
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.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	$192, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L20:
	leaq	-192(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-192(%rbp), %eax
	testl	%eax, %eax
	je	.L24
	movl	$0, -184(%rbp)
	jmp	.L12
.L17:
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	leaq	-176(%rax), %rdx
	movl	-184(%rbp), %eax
	movl	%eax, (%rdx)
	leaq	-176(%rbp), %rdx
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdx, %rax
	addq	$4, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$164, %rax
	movl	$0, (%rax)
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$164, %rax
	movl	(%rax), %eax
	movl	-184(%rbp), %edx
	movslq	%edx, %rdx
	salq	$4, %rdx
	addq	%rbp, %rdx
	subq	$168, %rdx
	movl	%eax, (%rdx)
	movl	$1, -180(%rbp)
	jmp	.L13
.L16:
	leaq	-188(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-188(%rbp), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$168, %rax
	movl	(%rax), %eax
	leal	1(%rax), %edx
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$168, %rax
	movl	%edx, (%rax)
	jmp	.L15
.L14:
	movl	-188(%rbp), %eax
	cmpl	$1, %eax
	jne	.L15
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$164, %rax
	movl	(%rax), %eax
	leal	1(%rax), %edx
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$164, %rax
	movl	%edx, (%rax)
.L15:
	addl	$1, -180(%rbp)
.L13:
	movl	-192(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jl	.L16
	addl	$1, -184(%rbp)
.L12:
	movl	-192(%rbp), %eax
	cmpl	%eax, -184(%rbp)
	jl	.L17
	movl	-192(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-176(%rbp), %rax
	leaq	qsort_comp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -184(%rbp)
	jmp	.L18
.L19:
	leaq	-176(%rbp), %rdx
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdx, %rax
	addq	$4, %rax
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -184(%rbp)
.L18:
	movl	-192(%rbp), %eax
	cmpl	%eax, -184(%rbp)
	jl	.L19
	jmp	.L20
.L24:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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	qsort_comp
	.type	qsort_comp, @function
qsort_comp:
.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, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	8(%rax), %edx
	movq	-8(%rbp), %rax
	movl	8(%rax), %eax
	cmpl	%eax, %edx
	jge	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-16(%rbp), %rax
	movl	8(%rax), %edx
	movq	-8(%rbp), %rax
	movl	8(%rax), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movq	-16(%rbp), %rax
	movl	12(%rax), %edx
	movq	-8(%rbp), %rax
	movl	12(%rax), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	$1, %eax
	jmp	.L3
.L5:
	movq	-16(%rbp), %rax
	movl	12(%rax), %edx
	movq	-8(%rbp), %rax
	movl	12(%rax), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	$-1, %eax
	jmp	.L3
.L6:
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L7
	movl	$1, %eax
	jmp	.L3
.L7:
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L8
	movl	$-1, %eax
	jmp	.L3
.L8:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	qsort_comp, .-qsort_comp
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.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	$192, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L20:
	leaq	-192(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-192(%rbp), %eax
	testl	%eax, %eax
	je	.L24
	movl	$0, -184(%rbp)
	jmp	.L12
.L17:
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	leaq	-176(%rax), %rdx
	movl	-184(%rbp), %eax
	movl	%eax, (%rdx)
	leaq	-176(%rbp), %rdx
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdx, %rax
	addq	$4, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$164, %rax
	movl	$0, (%rax)
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$164, %rax
	movl	(%rax), %eax
	movl	-184(%rbp), %edx
	movslq	%edx, %rdx
	salq	$4, %rdx
	addq	%rbp, %rdx
	subq	$168, %rdx
	movl	%eax, (%rdx)
	movl	$1, -180(%rbp)
	jmp	.L13
.L16:
	leaq	-188(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-188(%rbp), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$168, %rax
	movl	(%rax), %eax
	leal	1(%rax), %edx
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$168, %rax
	movl	%edx, (%rax)
	jmp	.L15
.L14:
	movl	-188(%rbp), %eax
	cmpl	$1, %eax
	jne	.L15
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$164, %rax
	movl	(%rax), %eax
	leal	1(%rax), %edx
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$164, %rax
	movl	%edx, (%rax)
.L15:
	addl	$1, -180(%rbp)
.L13:
	movl	-192(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jl	.L16
	addl	$1, -184(%rbp)
.L12:
	movl	-192(%rbp), %eax
	cmpl	%eax, -184(%rbp)
	jl	.L17
	movl	-192(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-176(%rbp), %rax
	leaq	qsort_comp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -184(%rbp)
	jmp	.L18
.L19:
	leaq	-176(%rbp), %rdx
	movl	-184(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdx, %rax
	addq	$4, %rax
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -184(%rbp)
.L18:
	movl	-192(%rbp), %eax
	cmpl	%eax, -184(%rbp)
	jl	.L19
	jmp	.L20
.L24:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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:
