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

```c
#include <string.h>

typedef struct{
  int no;
  int total;
}Rst;

int main(void){
  int i,j,n,m,x;
  Rst rst[100],tmp;

  while(1){
    scanf("%d%d",&n,&m);
    if(!n && !m) break;

    memset(rst,0,sizeof(rst));
    for(i=0;i<m;i++) rst[i].no=i+1;
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
        scanf("%d",&x);
        rst[j].total += x;
      }
    }
    for(i=0;i<m-1;i++){
      for(j=i+1;j<m;j++){
        if(rst[i].total < rst[j].total){
          tmp = rst[i];
          rst[i] = rst[j];
          rst[j] = tmp;
        }
        else if(rst[i].total == rst[j].total && rst[i].no > rst[j].no){
          tmp = rst[i];
          rst[i] = rst[j];
          rst[j] = tmp;
        }
      }
    }
    for(i=0;i<m-1;i++){
      printf("%d ",rst[i].no);
    }
    printf("%d\n",rst[i].no);
  }

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\n"
	.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	$848, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L18:
	leaq	-840(%rbp), %rdx
	leaq	-844(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-844(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-840(%rbp), %eax
	testl	%eax, %eax
	je	.L22
.L2:
	leaq	-816(%rbp), %rax
	movl	$800, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -832(%rbp)
	jmp	.L4
.L5:
	movl	-832(%rbp), %eax
	leal	1(%rax), %edx
	movl	-832(%rbp), %eax
	cltq
	movl	%edx, -816(%rbp,%rax,8)
	addl	$1, -832(%rbp)
.L4:
	movl	-840(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L5
	movl	$0, -832(%rbp)
	jmp	.L6
.L9:
	movl	$0, -828(%rbp)
	jmp	.L7
.L8:
	leaq	-836(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-828(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %edx
	movl	-836(%rbp), %eax
	addl	%eax, %edx
	movl	-828(%rbp), %eax
	cltq
	movl	%edx, -812(%rbp,%rax,8)
	addl	$1, -828(%rbp)
.L7:
	movl	-840(%rbp), %eax
	cmpl	%eax, -828(%rbp)
	jl	.L8
	addl	$1, -832(%rbp)
.L6:
	movl	-844(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L9
	movl	$0, -832(%rbp)
	jmp	.L10
.L15:
	movl	-832(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -828(%rbp)
	jmp	.L11
.L14:
	movl	-832(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %edx
	movl	-828(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jge	.L12
	movl	-832(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	movq	%rax, -824(%rbp)
	movl	-832(%rbp), %eax
	cltq
	movl	-828(%rbp), %edx
	movslq	%edx, %rdx
	movq	-816(%rbp,%rdx,8), %rdx
	movq	%rdx, -816(%rbp,%rax,8)
	movl	-828(%rbp), %eax
	cltq
	movq	-824(%rbp), %rdx
	movq	%rdx, -816(%rbp,%rax,8)
	jmp	.L13
.L12:
	movl	-832(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %edx
	movl	-828(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jne	.L13
	movl	-832(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,8), %edx
	movl	-828(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jle	.L13
	movl	-832(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	movq	%rax, -824(%rbp)
	movl	-832(%rbp), %eax
	cltq
	movl	-828(%rbp), %edx
	movslq	%edx, %rdx
	movq	-816(%rbp,%rdx,8), %rdx
	movq	%rdx, -816(%rbp,%rax,8)
	movl	-828(%rbp), %eax
	cltq
	movq	-824(%rbp), %rdx
	movq	%rdx, -816(%rbp,%rax,8)
.L13:
	addl	$1, -828(%rbp)
.L11:
	movl	-840(%rbp), %eax
	cmpl	%eax, -828(%rbp)
	jl	.L14
	addl	$1, -832(%rbp)
.L10:
	movl	-840(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -832(%rbp)
	jl	.L15
	movl	$0, -832(%rbp)
	jmp	.L16
.L17:
	movl	-832(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,8), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -832(%rbp)
.L16:
	movl	-840(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -832(%rbp)
	jl	.L17
	movl	-832(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,8), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L18
.L22:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB12:
	.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	.LC2(%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	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$872, %rsp
	.cfi_def_cfa_offset 928
	movq	%fs:40, %rax
	movq	%rax, 856(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L18:
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdx
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	36(%rsp), %r8d
	movl	40(%rsp), %esi
	movl	%r8d, %eax
	orl	%esi, %eax
	je	.L2
	movq	8(%rsp), %rdi
	xorl	%eax, %eax
	movl	$100, %ecx
	leal	1(%rsi), %edx
	rep stosq
	movq	8(%rsp), %rcx
	movl	$1, %eax
	testl	%esi, %esi
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%eax, -8(%rcx,%rax,8)
	addq	$1, %rax
	cmpq	%rdx, %rax
	jne	.L6
.L7:
	xorl	%r12d, %r12d
	testl	%r8d, %r8d
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	testl	%esi, %esi
	jle	.L21
	leaq	52(%rsp), %rbx
	xorl	%r13d, %r13d
	leaq	44(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	scanf@PLT
	movl	40(%rsp), %esi
	movl	44(%rsp), %eax
	addl	%eax, (%rbx)
	addq	$8, %rbx
	cmpl	%r13d, %esi
	jg	.L8
	addl	$1, %r12d
	cmpl	%r12d, 36(%rsp)
	jg	.L4
.L5:
	cmpl	$1, %esi
	jle	.L21
	movq	8(%rsp), %rcx
	leal	-2(%rsi), %r10d
	movl	$1, %r8d
	leaq	56(%rsp), %rbx
	addq	$2, %r10
	leal	-1(%rsi), %r11d
	movq	%rcx, %r9
	.p2align 4,,10
	.p2align 3
.L12:
	cmpl	%r8d, %esi
	jle	.L17
	movl	%r11d, %eax
	subl	%r8d, %eax
	leaq	-1(%r8,%rax), %rax
	leaq	(%rbx,%rax,8), %rdi
	movq	%rcx, %rax
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L35:
	movd	(%rcx), %xmm0
	movd	%edx, %xmm1
	movq	8(%rax), %rdx
	punpckldq	%xmm1, %xmm0
	movq	%rdx, (%rcx)
	movq	%xmm0, 8(%rax)
.L15:
	addq	$8, %rax
	cmpq	%rdi, %rax
	je	.L17
.L16:
	movl	4(%rcx), %edx
	cmpl	12(%rax), %edx
	jl	.L35
	jne	.L15
	movl	(%rcx), %r12d
	movd	%edx, %xmm2
	movd	%r12d, %xmm0
	punpckldq	%xmm2, %xmm0
	cmpl	8(%rax), %r12d
	jle	.L15
	movq	8(%rax), %rdx
	addq	$8, %rax
	movq	%rdx, (%rcx)
	movq	%xmm0, (%rax)
	cmpq	%rdi, %rax
	jne	.L16
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %r8
	addq	$8, %rcx
	cmpq	%r10, %r8
	jne	.L12
	xorl	%r12d, %r12d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L36:
	addq	$8, %rbx
.L13:
	movl	(%r9), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	printf@PLT
	movl	40(%rsp), %eax
	movq	%rbx, %r9
	subl	$1, %eax
	cmpl	%r12d, %eax
	jg	.L36
.L10:
	movslq	%r12d, %r12
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	movl	48(%rsp,%r12,8), %esi
	call	printf@PLT
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L21:
	xorl	%r12d, %r12d
	jmp	.L10
.L2:
	movq	856(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$872, %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
.L37:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE12:
	.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	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB12:
	.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	.LC2(%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	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$872, %rsp
	.cfi_def_cfa_offset 928
	movq	%fs:40, %rax
	movq	%rax, 856(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L18:
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdx
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	36(%rsp), %r8d
	movl	40(%rsp), %esi
	movl	%r8d, %eax
	orl	%esi, %eax
	je	.L2
	movq	8(%rsp), %rdi
	xorl	%eax, %eax
	movl	$100, %ecx
	leal	1(%rsi), %edx
	rep stosq
	movq	8(%rsp), %rcx
	movl	$1, %eax
	testl	%esi, %esi
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%eax, -8(%rcx,%rax,8)
	addq	$1, %rax
	cmpq	%rdx, %rax
	jne	.L6
.L7:
	xorl	%r12d, %r12d
	testl	%r8d, %r8d
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	testl	%esi, %esi
	jle	.L21
	leaq	52(%rsp), %rbx
	xorl	%r13d, %r13d
	leaq	44(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	scanf@PLT
	movl	40(%rsp), %esi
	movl	44(%rsp), %eax
	addl	%eax, (%rbx)
	addq	$8, %rbx
	cmpl	%r13d, %esi
	jg	.L8
	addl	$1, %r12d
	cmpl	%r12d, 36(%rsp)
	jg	.L4
.L5:
	cmpl	$1, %esi
	jle	.L21
	movq	8(%rsp), %rcx
	leal	-2(%rsi), %r10d
	movl	$1, %r8d
	leaq	56(%rsp), %rbx
	addq	$2, %r10
	leal	-1(%rsi), %r11d
	movq	%rcx, %r9
	.p2align 4,,10
	.p2align 3
.L12:
	cmpl	%r8d, %esi
	jle	.L17
	movl	%r11d, %eax
	subl	%r8d, %eax
	leaq	-1(%r8,%rax), %rax
	leaq	(%rbx,%rax,8), %rdi
	movq	%rcx, %rax
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L35:
	movd	(%rcx), %xmm0
	movd	%edx, %xmm1
	movq	8(%rax), %rdx
	punpckldq	%xmm1, %xmm0
	movq	%rdx, (%rcx)
	movq	%xmm0, 8(%rax)
.L15:
	addq	$8, %rax
	cmpq	%rdi, %rax
	je	.L17
.L16:
	movl	4(%rcx), %edx
	cmpl	12(%rax), %edx
	jl	.L35
	jne	.L15
	movl	(%rcx), %r12d
	movd	%edx, %xmm2
	movd	%r12d, %xmm0
	punpckldq	%xmm2, %xmm0
	cmpl	8(%rax), %r12d
	jle	.L15
	movq	8(%rax), %rdx
	addq	$8, %rax
	movq	%rdx, (%rcx)
	movq	%xmm0, (%rax)
	cmpq	%rdi, %rax
	jne	.L16
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %r8
	addq	$8, %rcx
	cmpq	%r10, %r8
	jne	.L12
	xorl	%r12d, %r12d
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L36:
	addq	$8, %rbx
.L13:
	movl	(%r9), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	printf@PLT
	movl	40(%rsp), %eax
	movq	%rbx, %r9
	subl	$1, %eax
	cmpl	%r12d, %eax
	jg	.L36
.L10:
	movslq	%r12d, %r12
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	movl	48(%rsp,%r12,8), %esi
	call	printf@PLT
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L21:
	xorl	%r12d, %r12d
	jmp	.L10
.L2:
	movq	856(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$872, %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
.L37:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE12:
	.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 <string.h>

typedef struct{
  int no;
  int total;
}Rst;

int main(void){
  int i,j,n,m,x;
  Rst rst[100],tmp;

  while(1){
    scanf("%d%d",&n,&m);
    if(!n && !m) break;

    memset(rst,0,sizeof(rst));
    for(i=0;i<m;i++) rst[i].no=i+1;
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
        scanf("%d",&x);
        rst[j].total += x;
      }
    }
    for(i=0;i<m-1;i++){
      for(j=i+1;j<m;j++){
        if(rst[i].total < rst[j].total){
          tmp = rst[i];
          rst[i] = rst[j];
          rst[j] = tmp;
        }
        else if(rst[i].total == rst[j].total && rst[i].no > rst[j].no){
          tmp = rst[i];
          rst[i] = rst[j];
          rst[j] = tmp;
        }
      }
    }
    for(i=0;i<m-1;i++){
      printf("%d ",rst[i].no);
    }
    printf("%d\n",rst[i].no);
  }

  return 0;
}
4 6
1 0 1 0 1 1
1 2 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
4 6
1 0 1 0 1 1
1 1 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
0 0
 4 6
1 0 1 0 1 1
1 2 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
4 6
1 0 1 0 1 1
2 1 0 1 1 0
1 1 1 0 0 0
1 0 1 0 1 0
0 0
 4 6
1 0 1 0 1 1
1 1 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
4 6
0 0 1 0 1 1
1 1 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
0 0
 4 6
1 0 1 0 1 1
1 2 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
4 6
1 0 1 0 1 1
1 1 -1 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
0 0
 4 6
1 0 1 0 1 2
1 2 0 1 1 0
1 1 1 0 0 0
1 0 1 0 1 0
4 6
1 0 1 0 1 1
2 1 0 1 1 0
1 1 1 0 0 0
1 0 1 0 1 0
0 0
 4 6
1 0 1 0 1 1
1 1 0 1 0 0
1 0 1 0 0 0
1 0 1 0 1 0
4 6
0 0 1 0 1 1
1 1 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
0 0
 4 6
1 0 1 0 1 1
1 2 0 1 0 0
1 1 1 0 0 1
1 0 1 0 1 0
4 6
1 0 1 0 1 1
1 1 -1 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
0 0
 4 6
1 0 0 0 1 1
1 2 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
4 6
1 0 1 0 1 1
2 1 0 1 1 0
1 1 0 0 0 0
1 0 1 0 1 0
0 0
 4 6
1 0 1 0 1 2
1 0 0 1 1 0
1 1 1 0 0 0
1 0 1 0 1 0
4 6
1 0 1 0 1 1
2 1 0 1 1 0
1 1 1 0 0 0
1 0 1 0 1 0
0 0
 4 6
1 0 1 0 1 1
1 1 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
4 6
0 0 1 0 1 1
1 1 0 1 0 0
1 1 1 0 0 0
1 -1 1 0 1 0
0 0

1 2 3 5 4 6
1 3 2 5 4 6
 1 2 3 5 4 6
1 3 5 2 4 6
 1 3 2 5 4 6
1 3 2 5 4 6
 1 2 3 5 4 6
1 2 3 5 4 6
 1 2 3 5 6 4
1 3 5 2 4 6
 1 3 5 2 4 6
1 3 2 5 4 6
 1 2 3 5 6 4
1 2 3 5 4 6
 1 2 3 5 4 6
1 5 2 3 4 6
 1 3 5 6 2 4
1 3 5 2 4 6
 1 3 2 5 4 6
1 3 5 2 4 6

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

```c
#include <string.h>

typedef struct{
  int no;
  int total;
}Rst;

int main(void){
  int i,j,n,m,x;
  Rst rst[100],tmp;

  while(1){
    scanf("%d%d",&n,&m);
    if(!n && !m) break;

    memset(rst,0,sizeof(rst));
    for(i=0;i<m;i++) rst[i].no=i+1;
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
        scanf("%d",&x);
        rst[j].total += x;
      }
    }
    for(i=0;i<m-1;i++){
      for(j=i+1;j<m;j++){
        if(rst[i].total < rst[j].total){
          tmp = rst[i];
          rst[i] = rst[j];
          rst[j] = tmp;
        }
        else if(rst[i].total == rst[j].total && rst[i].no > rst[j].no){
          tmp = rst[i];
          rst[i] = rst[j];
          rst[j] = tmp;
        }
      }
    }
    for(i=0;i<m-1;i++){
      printf("%d ",rst[i].no);
    }
    printf("%d\n",rst[i].no);
  }

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\n"
	.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	$848, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L18:
	leaq	-840(%rbp), %rdx
	leaq	-844(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-844(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-840(%rbp), %eax
	testl	%eax, %eax
	je	.L22
.L2:
	leaq	-816(%rbp), %rax
	movl	$800, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -832(%rbp)
	jmp	.L4
.L5:
	movl	-832(%rbp), %eax
	leal	1(%rax), %edx
	movl	-832(%rbp), %eax
	cltq
	movl	%edx, -816(%rbp,%rax,8)
	addl	$1, -832(%rbp)
.L4:
	movl	-840(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L5
	movl	$0, -832(%rbp)
	jmp	.L6
.L9:
	movl	$0, -828(%rbp)
	jmp	.L7
.L8:
	leaq	-836(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-828(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %edx
	movl	-836(%rbp), %eax
	addl	%eax, %edx
	movl	-828(%rbp), %eax
	cltq
	movl	%edx, -812(%rbp,%rax,8)
	addl	$1, -828(%rbp)
.L7:
	movl	-840(%rbp), %eax
	cmpl	%eax, -828(%rbp)
	jl	.L8
	addl	$1, -832(%rbp)
.L6:
	movl	-844(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L9
	movl	$0, -832(%rbp)
	jmp	.L10
.L15:
	movl	-832(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -828(%rbp)
	jmp	.L11
.L14:
	movl	-832(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %edx
	movl	-828(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jge	.L12
	movl	-832(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	movq	%rax, -824(%rbp)
	movl	-832(%rbp), %eax
	cltq
	movl	-828(%rbp), %edx
	movslq	%edx, %rdx
	movq	-816(%rbp,%rdx,8), %rdx
	movq	%rdx, -816(%rbp,%rax,8)
	movl	-828(%rbp), %eax
	cltq
	movq	-824(%rbp), %rdx
	movq	%rdx, -816(%rbp,%rax,8)
	jmp	.L13
.L12:
	movl	-832(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %edx
	movl	-828(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jne	.L13
	movl	-832(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,8), %edx
	movl	-828(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jle	.L13
	movl	-832(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	movq	%rax, -824(%rbp)
	movl	-832(%rbp), %eax
	cltq
	movl	-828(%rbp), %edx
	movslq	%edx, %rdx
	movq	-816(%rbp,%rdx,8), %rdx
	movq	%rdx, -816(%rbp,%rax,8)
	movl	-828(%rbp), %eax
	cltq
	movq	-824(%rbp), %rdx
	movq	%rdx, -816(%rbp,%rax,8)
.L13:
	addl	$1, -828(%rbp)
.L11:
	movl	-840(%rbp), %eax
	cmpl	%eax, -828(%rbp)
	jl	.L14
	addl	$1, -832(%rbp)
.L10:
	movl	-840(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -832(%rbp)
	jl	.L15
	movl	$0, -832(%rbp)
	jmp	.L16
.L17:
	movl	-832(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,8), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -832(%rbp)
.L16:
	movl	-840(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -832(%rbp)
	jl	.L17
	movl	-832(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,8), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L18
.L22:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\n"
	.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	$848, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L18:
	leaq	-840(%rbp), %rdx
	leaq	-844(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-844(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-840(%rbp), %eax
	testl	%eax, %eax
	je	.L22
.L2:
	leaq	-816(%rbp), %rax
	movl	$800, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -832(%rbp)
	jmp	.L4
.L5:
	movl	-832(%rbp), %eax
	leal	1(%rax), %edx
	movl	-832(%rbp), %eax
	cltq
	movl	%edx, -816(%rbp,%rax,8)
	addl	$1, -832(%rbp)
.L4:
	movl	-840(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L5
	movl	$0, -832(%rbp)
	jmp	.L6
.L9:
	movl	$0, -828(%rbp)
	jmp	.L7
.L8:
	leaq	-836(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-828(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %edx
	movl	-836(%rbp), %eax
	addl	%eax, %edx
	movl	-828(%rbp), %eax
	cltq
	movl	%edx, -812(%rbp,%rax,8)
	addl	$1, -828(%rbp)
.L7:
	movl	-840(%rbp), %eax
	cmpl	%eax, -828(%rbp)
	jl	.L8
	addl	$1, -832(%rbp)
.L6:
	movl	-844(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L9
	movl	$0, -832(%rbp)
	jmp	.L10
.L15:
	movl	-832(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -828(%rbp)
	jmp	.L11
.L14:
	movl	-832(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %edx
	movl	-828(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jge	.L12
	movl	-832(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	movq	%rax, -824(%rbp)
	movl	-832(%rbp), %eax
	cltq
	movl	-828(%rbp), %edx
	movslq	%edx, %rdx
	movq	-816(%rbp,%rdx,8), %rdx
	movq	%rdx, -816(%rbp,%rax,8)
	movl	-828(%rbp), %eax
	cltq
	movq	-824(%rbp), %rdx
	movq	%rdx, -816(%rbp,%rax,8)
	jmp	.L13
.L12:
	movl	-832(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %edx
	movl	-828(%rbp), %eax
	cltq
	movl	-812(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jne	.L13
	movl	-832(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,8), %edx
	movl	-828(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jle	.L13
	movl	-832(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	movq	%rax, -824(%rbp)
	movl	-832(%rbp), %eax
	cltq
	movl	-828(%rbp), %edx
	movslq	%edx, %rdx
	movq	-816(%rbp,%rdx,8), %rdx
	movq	%rdx, -816(%rbp,%rax,8)
	movl	-828(%rbp), %eax
	cltq
	movq	-824(%rbp), %rdx
	movq	%rdx, -816(%rbp,%rax,8)
.L13:
	addl	$1, -828(%rbp)
.L11:
	movl	-840(%rbp), %eax
	cmpl	%eax, -828(%rbp)
	jl	.L14
	addl	$1, -832(%rbp)
.L10:
	movl	-840(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -832(%rbp)
	jl	.L15
	movl	$0, -832(%rbp)
	jmp	.L16
.L17:
	movl	-832(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,8), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -832(%rbp)
.L16:
	movl	-840(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -832(%rbp)
	jl	.L17
	movl	-832(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,8), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L18
.L22:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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:
