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

```c
/*
  ICPCの解答提出のログが与えられたとき， 各チームの順位を表示
 */

#include <stdio.h>

#define T_MAX 50 // チーム数の上限
#define P_MAX 10 // 問題数の上限

// フラグ
#define SORTED 0 
#define NOT_SORTED -1

/* 構造体Team_score: チームあたりのデータ */
typedef struct {
  long time; // 所要時間
  int num; // 回答問題数
  int penalty[P_MAX]; // 問題
} Team_score;

int main(void) {
  int M, T, P, R; // コンテストの始まりから終わりまでの時間、チーム数、問題数、提出記録の数
  
  while (scanf("%d %d %d %d", &M, &T, &P, &R) != EOF) { // 一行ずつデータを読み込む
    int i, k;
    int m, t, p, j; // 経過時間、チーム番号、問題番号、正誤
    Team_score scores[T_MAX];
    int ranking[T_MAX]; // 順位の順番にチーム番号を格納（ただしチーム番号は-1されている）
    int flag_sorted;
    
    if (M==0 && T==0 && P==0 && R==0) // 終了判定
      break;

    /* チーム記録（構造体）を0で初期化 */
    for (i=0; i<T; i++) {
      scores[i].time = 0;
      scores[i].num = 0;
      for (k=0; k<P; k++) {
	scores[i].penalty[k] = 0;
      }
    }


    /* 提出記録を順番に読み込んで、各チームの正解数、所要時間などを計算 */
    for (i=0; i<R; i++) {
      
      scanf("%d %d %d %d", &m, &t, &p, &j); // 提出記録を読み込む
      if (j == 0) { // もし問題に正解していれば
	scores[t-1].time += m + scores[t-1].penalty[p-1] * 20; // 所要時間を加算
	scores[t-1].num += 1; // 正解問題数をインクリメント
      } else { // もし誤答だったら
	scores[t-1].penalty[p-1] += 1; // 問題あたりの誤答数をインクリメント
      }
    }

    /* 順位を表す配列を初期化 */
    for (i=0; i<T; i++) 
      ranking[i] = i;

    /* 順位付け: 順位の基準にしたがって、チームの順番をソートして順位付け */
    do {
      flag_sorted = NOT_SORTED;
      
      for (k=0; k<=T-2; k++) {
	if (/* 正答数が多いか */
	    (scores[ranking[k]].num < scores[ranking[k+1]].num)
	    /* 正当数は同じであるが、所要時間が短いか */
	    || (scores[ranking[k]].num == scores[ranking[k+1]].num
		&& scores[ranking[k]].time > scores[ranking[k+1]].time)
	    /* 同じ順位であるが、後ろのほうがチーム番号が多いとき */
	    || (scores[ranking[k]].num == scores[ranking[k+1]].num
		&& scores[ranking[k]].time == scores[ranking[k+1]].time
		&& ranking[k] < ranking[k+1])) {
	  /* チーム番号を入れ替え */
	  int tmp = ranking[k];
	  ranking[k] = ranking[k+1];
	  ranking[k+1] = tmp;

	  flag_sorted = SORTED; // 入れ替えられた
	}
      }
    } while (flag_sorted == SORTED); // 入れ替えられなくなったら終了

    /* 順位を表示 */
    printf("%d", ranking[0]+1); // トップのチームの番号を表示 
    for (i=1; i<T; i++) {
      if (scores[ranking[i-1]].num == scores[ranking[i]].num
	  && scores[ranking[i-1]].time == scores[ranking[i]].time) { // 前のチームと同順だったら
	printf("=%d", ranking[i]+1); // '='を使って表示
      } else { //そうでなかったら
	printf(",%d", ranking[i]+1); // ','を使って表示
      }
    }
    putchar('\n');
  }
  
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"=%d"
.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	$3072, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L25:
	movl	-3072(%rbp), %eax
	testl	%eax, %eax
	jne	.L3
	movl	-3068(%rbp), %eax
	testl	%eax, %eax
	jne	.L3
	movl	-3064(%rbp), %eax
	testl	%eax, %eax
	jne	.L3
	movl	-3060(%rbp), %eax
	testl	%eax, %eax
	je	.L28
.L3:
	movl	$0, -3040(%rbp)
	jmp	.L5
.L8:
	movl	-3040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	$0, (%rax)
	movl	-3040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	$0, (%rax)
	movl	$0, -3036(%rbp)
	jmp	.L6
.L7:
	movl	-3036(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	$0, -2804(%rbp,%rax,4)
	addl	$1, -3036(%rbp)
.L6:
	movl	-3064(%rbp), %eax
	cmpl	%eax, -3036(%rbp)
	jl	.L7
	addl	$1, -3040(%rbp)
.L5:
	movl	-3068(%rbp), %eax
	cmpl	%eax, -3040(%rbp)
	jl	.L8
	movl	$0, -3040(%rbp)
	jmp	.L9
.L12:
	leaq	-3044(%rbp), %rsi
	leaq	-3048(%rbp), %rcx
	leaq	-3052(%rbp), %rdx
	leaq	-3056(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-3044(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-3052(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rcx
	movl	-3052(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-3048(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	movl	-2804(%rbp,%rax,4), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	sall	$2, %eax
	movl	%eax, %edx
	movl	-3056(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	movl	-3052(%rbp), %eax
	subl	$1, %eax
	addq	%rdx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	%rcx, (%rax)
	movl	-3052(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	movl	-3052(%rbp), %edx
	subl	$1, %edx
	leal	1(%rax), %ecx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	%ecx, (%rax)
	jmp	.L11
.L10:
	movl	-3052(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-3048(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-2804(%rbp,%rax,4), %eax
	movl	-3052(%rbp), %edx
	leal	-1(%rdx), %esi
	movl	-3048(%rbp), %edx
	subl	$1, %edx
	leal	1(%rax), %ecx
	movslq	%edx, %rdi
	movslq	%esi, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	movl	%ecx, -2804(%rbp,%rax,4)
.L11:
	addl	$1, -3040(%rbp)
.L9:
	movl	-3060(%rbp), %eax
	cmpl	%eax, -3040(%rbp)
	jl	.L12
	movl	$0, -3040(%rbp)
	jmp	.L13
.L14:
	movl	-3040(%rbp), %eax
	cltq
	movl	-3040(%rbp), %edx
	movl	%edx, -3024(%rbp,%rax,4)
	addl	$1, -3040(%rbp)
.L13:
	movl	-3068(%rbp), %eax
	cmpl	%eax, -3040(%rbp)
	jl	.L14
.L20:
	movl	$-1, -3032(%rbp)
	movl	$0, -3036(%rbp)
	jmp	.L15
.L19:
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %ecx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jl	.L16
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %ecx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L17
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rcx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rcx
	jg	.L16
.L17:
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %ecx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L18
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rcx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rcx
	jne	.L18
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %edx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L18
.L16:
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movl	%eax, -3028(%rbp)
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %edx
	movl	-3036(%rbp), %eax
	cltq
	movl	%edx, -3024(%rbp,%rax,4)
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3028(%rbp), %edx
	movl	%edx, -3024(%rbp,%rax,4)
	movl	$0, -3032(%rbp)
.L18:
	addl	$1, -3036(%rbp)
.L15:
	movl	-3068(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -3036(%rbp)
	jl	.L19
	cmpl	$0, -3032(%rbp)
	je	.L20
	movl	-3024(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -3040(%rbp)
	jmp	.L21
.L24:
	movl	-3040(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %ecx
	movl	-3040(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L22
	movl	-3040(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rcx
	movl	-3040(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rcx
	jne	.L22
	movl	-3040(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L23
.L22:
	movl	-3040(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L23:
	addl	$1, -3040(%rbp)
.L21:
	movl	-3068(%rbp), %eax
	cmpl	%eax, -3040(%rbp)
	jl	.L24
	movl	$10, %edi
	call	putchar@PLT
.L2:
	leaq	-3060(%rbp), %rsi
	leaq	-3064(%rbp), %rcx
	leaq	-3068(%rbp), %rdx
	leaq	-3072(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L25
	jmp	.L4
.L28:
	nop
.L4:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	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 %d %d"
.LC13:
	.string	"%d"
.LC14:
	.string	"=%d"
.LC15:
	.string	",%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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
	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	$3096, %rsp
	.cfi_def_cfa_offset 3152
	movq	%fs:40, %rax
	movq	%rax, 3080(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	24(%rsp), %r8
	movq	16(%rsp), %rcx
	xorl	%eax, %eax
	movq	%rbp, %rdi
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L30
	movl	36(%rsp), %r15d
	movl	44(%rsp), %r14d
	movl	%r15d, %eax
	orl	32(%rsp), %eax
	jne	.L90
	movl	%r14d, %eax
	orl	40(%rsp), %eax
	je	.L30
.L5:
	testl	%r14d, %r14d
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L32:
	xorl	%r15d, %r15d
	leaq	60(%rsp), %r14
	leaq	56(%rsp), %r13
	leaq	52(%rsp), %r12
	leaq	48(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r12, %rdx
	movq	%r14, %r8
	movq	%r13, %rcx
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	60(%rsp), %edx
	movl	52(%rsp), %eax
	testl	%edx, %edx
	jne	.L11
	leal	-1(%rax), %edx
	movl	56(%rsp), %edi
	addl	$1, %r15d
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rax
	subq	%rdx, %rax
	leal	-1(%rdi), %edx
	movslq	%edx, %rdx
	leaq	(%rdx,%rax,2), %rdx
	movl	284(%rsp,%rdx,4), %edx
	leal	(%rdx,%rdx,4), %ecx
	movl	48(%rsp), %edx
	leal	(%rdx,%rcx,4), %edx
	leaq	0(,%rax,8), %rcx
	movslq	%edx, %rdx
	addl	$1, 280(%rsp,%rcx)
	addq	%rdx, 272(%rsp,%rax,8)
	cmpl	%r15d, 44(%rsp)
	jg	.L14
.L13:
	movl	36(%rsp), %r15d
	testl	%r15d, %r15d
	jle	.L15
.L33:
	testl	%r15d, %r15d
	movl	$1, %edx
	cmovg	%r15d, %edx
	cmpl	$3, %r15d
	jle	.L35
	movdqa	.LC1(%rip), %xmm3
	movl	%edx, %eax
	shrl	$2, %eax
	movaps	%xmm3, 64(%rsp)
	cmpl	$1, %eax
	je	.L17
	movdqa	.LC2(%rip), %xmm4
	movaps	%xmm4, 80(%rsp)
	cmpl	$2, %eax
	je	.L17
	movdqa	.LC3(%rip), %xmm5
	movaps	%xmm5, 96(%rsp)
	cmpl	$3, %eax
	je	.L17
	movdqa	.LC4(%rip), %xmm6
	movaps	%xmm6, 112(%rsp)
	cmpl	$4, %eax
	je	.L17
	movdqa	.LC5(%rip), %xmm0
	movaps	%xmm0, 128(%rsp)
	cmpl	$5, %eax
	je	.L17
	movdqa	.LC6(%rip), %xmm0
	movaps	%xmm0, 144(%rsp)
	cmpl	$6, %eax
	je	.L17
	movdqa	.LC7(%rip), %xmm0
	movaps	%xmm0, 160(%rsp)
	cmpl	$7, %eax
	je	.L17
	movdqa	.LC8(%rip), %xmm0
	movaps	%xmm0, 176(%rsp)
	cmpl	$8, %eax
	je	.L17
	movdqa	.LC9(%rip), %xmm0
	movaps	%xmm0, 192(%rsp)
	cmpl	$9, %eax
	je	.L17
	movdqa	.LC10(%rip), %xmm0
	movaps	%xmm0, 208(%rsp)
	cmpl	$10, %eax
	je	.L17
	movdqa	.LC11(%rip), %xmm0
	movaps	%xmm0, 224(%rsp)
	cmpl	$11, %eax
	je	.L17
	movdqa	.LC12(%rip), %xmm0
	movaps	%xmm0, 240(%rsp)
.L17:
	movl	%edx, %eax
	andl	$-4, %eax
	andl	$3, %edx
	je	.L15
.L16:
	movslq	%eax, %rdx
	movl	%eax, 64(%rsp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %r15d
	jle	.L15
	movslq	%edx, %rcx
	addl	$2, %eax
	movl	%edx, 64(%rsp,%rcx,4)
	cmpl	%eax, %r15d
	jle	.L15
	movslq	%eax, %rdx
	movl	%eax, 64(%rsp,%rdx,4)
.L15:
	leal	-2(%r15), %eax
	leaq	68(%rsp), %rbx
	leaq	64(%rsp), %r13
	leaq	(%rbx,%rax,4), %r9
	.p2align 4,,10
	.p2align 3
.L25:
	movslq	64(%rsp), %rax
	cmpl	$1, %r15d
	jle	.L26
	leaq	0(,%rax,8), %rdx
	movq	%r13, %rcx
	movl	$-1, %r10d
	subq	%rax, %rdx
	movl	280(%rsp,%rdx,8), %edi
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L93:
	je	.L91
	movl	%esi, %edi
.L23:
	addq	$4, %rcx
	cmpq	%r9, %rcx
	je	.L92
.L24:
	movq	(%rcx), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm2, %edx
	pshufd	$225, %xmm0, %xmm1
	movd	%xmm0, %r8d
	movslq	%edx, %rsi
	leaq	0(,%rsi,8), %rax
	subq	%rsi, %rax
	salq	$3, %rax
	movl	280(%rsp,%rax), %esi
	cmpl	%edi, %esi
	jle	.L93
.L22:
	movq	%xmm1, (%rcx)
	xorl	%r10d, %r10d
.L95:
	addq	$4, %rcx
	cmpq	%r9, %rcx
	jne	.L24
.L92:
	testl	%r10d, %r10d
	je	.L25
	movl	64(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L26:
	leal	1(%rax), %edx
	leaq	.LC13(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	cmpl	$1, 36(%rsp)
	movl	$1, %r14d
	leaq	.LC15(%rip), %r12
	leaq	.LC14(%rip), %r13
	jle	.L21
	.p2align 4,,10
	.p2align 3
.L29:
	movslq	-4(%rbx), %rdx
	movslq	(%rbx), %rax
	leaq	0(,%rdx,8), %rcx
	leal	1(%rax), %r8d
	subq	%rdx, %rcx
	leaq	0(,%rax,8), %rdx
	subq	%rax, %rdx
	leaq	0(,%rcx,8), %rsi
	movl	280(%rsp,%rdx,8), %edi
	leaq	0(,%rdx,8), %rax
	movl	%r8d, %edx
	cmpl	%edi, 280(%rsp,%rcx,8)
	jne	.L27
	movq	272(%rsp,%rax), %rax
	cmpq	%rax, 272(%rsp,%rsi)
	je	.L94
.L27:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L28:
	addl	$1, %r14d
	addq	$4, %rbx
	cmpl	%r14d, 36(%rsp)
	jg	.L29
.L21:
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	call	putc@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L91:
	movslq	%r8d, %r11
	movq	272(%rsp,%rax), %rax
	leaq	0(,%r11,8), %rsi
	subq	%r11, %rsi
	movq	272(%rsp,%rsi,8), %rsi
	cmpq	%rax, %rsi
	jg	.L22
	cmpl	%r8d, %edx
	jle	.L23
	cmpq	%rax, %rsi
	jne	.L23
	movq	%xmm1, (%rcx)
	xorl	%r10d, %r10d
	jmp	.L95
	.p2align 4,,10
	.p2align 3
.L11:
	movl	56(%rsp), %edi
	subl	$1, %eax
	addl	$1, %r15d
	cltq
	leaq	0(,%rax,8), %rcx
	leal	-1(%rdi), %edx
	movslq	%edx, %rdx
	subq	%rax, %rcx
	leaq	(%rdx,%rcx,2), %rax
	addl	$1, 284(%rsp,%rax,4)
	cmpl	%r15d, 44(%rsp)
	jg	.L14
	jmp	.L13
.L90:
	testl	%r15d, %r15d
	jle	.L5
	leal	-1(%r15), %edx
	movl	40(%rsp), %ebx
	leaq	284(%rsp), %rcx
	leaq	0(,%rdx,8), %rax
	subq	%rdx, %rax
	leaq	340(%rsp,%rax,8), %r12
	leal	-1(%rbx), %eax
	leaq	4(,%rax,4), %r13
	.p2align 4,,10
	.p2align 3
.L8:
	movq	$0, -12(%rcx)
	movl	$0, -4(%rcx)
	testl	%ebx, %ebx
	jle	.L10
	movq	%rcx, %rdi
	movq	%r13, %rdx
	xorl	%esi, %esi
	call	memset@PLT
	movq	%rax, %rcx
.L10:
	addq	$56, %rcx
	cmpq	%r12, %rcx
	jne	.L8
	testl	%r14d, %r14d
	jg	.L32
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L94:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L28
.L35:
	xorl	%eax, %eax
	jmp	.L16
.L30:
	movq	3080(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L96
	addq	$3096, %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
.L96:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	5
	.long	6
	.long	7
	.align 16
.LC3:
	.long	8
	.long	9
	.long	10
	.long	11
	.align 16
.LC4:
	.long	12
	.long	13
	.long	14
	.long	15
	.align 16
.LC5:
	.long	16
	.long	17
	.long	18
	.long	19
	.align 16
.LC6:
	.long	20
	.long	21
	.long	22
	.long	23
	.align 16
.LC7:
	.long	24
	.long	25
	.long	26
	.long	27
	.align 16
.LC8:
	.long	28
	.long	29
	.long	30
	.long	31
	.align 16
.LC9:
	.long	32
	.long	33
	.long	34
	.long	35
	.align 16
.LC10:
	.long	36
	.long	37
	.long	38
	.long	39
	.align 16
.LC11:
	.long	40
	.long	41
	.long	42
	.long	43
	.align 16
.LC12:
	.long	44
	.long	45
	.long	46
	.long	47
	.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 %d %d"
.LC13:
	.string	"%d"
.LC14:
	.string	"=%d"
.LC15:
	.string	",%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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
	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	$3096, %rsp
	.cfi_def_cfa_offset 3152
	movq	%fs:40, %rax
	movq	%rax, 3080(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	24(%rsp), %r8
	movq	16(%rsp), %rcx
	xorl	%eax, %eax
	movq	%rbp, %rdi
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L30
	movl	36(%rsp), %r15d
	movl	44(%rsp), %r14d
	movl	%r15d, %eax
	orl	32(%rsp), %eax
	jne	.L90
	movl	%r14d, %eax
	orl	40(%rsp), %eax
	je	.L30
.L5:
	testl	%r14d, %r14d
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L32:
	xorl	%r15d, %r15d
	leaq	60(%rsp), %r14
	leaq	56(%rsp), %r13
	leaq	52(%rsp), %r12
	leaq	48(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r12, %rdx
	movq	%r14, %r8
	movq	%r13, %rcx
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	60(%rsp), %edx
	movl	52(%rsp), %eax
	testl	%edx, %edx
	jne	.L11
	leal	-1(%rax), %edx
	movl	56(%rsp), %edi
	addl	$1, %r15d
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rax
	subq	%rdx, %rax
	leal	-1(%rdi), %edx
	movslq	%edx, %rdx
	leaq	(%rdx,%rax,2), %rdx
	movl	284(%rsp,%rdx,4), %edx
	leal	(%rdx,%rdx,4), %ecx
	movl	48(%rsp), %edx
	leal	(%rdx,%rcx,4), %edx
	leaq	0(,%rax,8), %rcx
	movslq	%edx, %rdx
	addl	$1, 280(%rsp,%rcx)
	addq	%rdx, 272(%rsp,%rax,8)
	cmpl	%r15d, 44(%rsp)
	jg	.L14
.L13:
	movl	36(%rsp), %r15d
	testl	%r15d, %r15d
	jle	.L15
.L33:
	testl	%r15d, %r15d
	movl	$1, %edx
	cmovg	%r15d, %edx
	cmpl	$3, %r15d
	jle	.L35
	movdqa	.LC1(%rip), %xmm3
	movl	%edx, %eax
	shrl	$2, %eax
	movaps	%xmm3, 64(%rsp)
	cmpl	$1, %eax
	je	.L17
	movdqa	.LC2(%rip), %xmm4
	movaps	%xmm4, 80(%rsp)
	cmpl	$2, %eax
	je	.L17
	movdqa	.LC3(%rip), %xmm5
	movaps	%xmm5, 96(%rsp)
	cmpl	$3, %eax
	je	.L17
	movdqa	.LC4(%rip), %xmm6
	movaps	%xmm6, 112(%rsp)
	cmpl	$4, %eax
	je	.L17
	movdqa	.LC5(%rip), %xmm0
	movaps	%xmm0, 128(%rsp)
	cmpl	$5, %eax
	je	.L17
	movdqa	.LC6(%rip), %xmm0
	movaps	%xmm0, 144(%rsp)
	cmpl	$6, %eax
	je	.L17
	movdqa	.LC7(%rip), %xmm0
	movaps	%xmm0, 160(%rsp)
	cmpl	$7, %eax
	je	.L17
	movdqa	.LC8(%rip), %xmm0
	movaps	%xmm0, 176(%rsp)
	cmpl	$8, %eax
	je	.L17
	movdqa	.LC9(%rip), %xmm0
	movaps	%xmm0, 192(%rsp)
	cmpl	$9, %eax
	je	.L17
	movdqa	.LC10(%rip), %xmm0
	movaps	%xmm0, 208(%rsp)
	cmpl	$10, %eax
	je	.L17
	movdqa	.LC11(%rip), %xmm0
	movaps	%xmm0, 224(%rsp)
	cmpl	$11, %eax
	je	.L17
	movdqa	.LC12(%rip), %xmm0
	movaps	%xmm0, 240(%rsp)
.L17:
	movl	%edx, %eax
	andl	$-4, %eax
	andl	$3, %edx
	je	.L15
.L16:
	movslq	%eax, %rdx
	movl	%eax, 64(%rsp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %r15d
	jle	.L15
	movslq	%edx, %rcx
	addl	$2, %eax
	movl	%edx, 64(%rsp,%rcx,4)
	cmpl	%eax, %r15d
	jle	.L15
	movslq	%eax, %rdx
	movl	%eax, 64(%rsp,%rdx,4)
.L15:
	leal	-2(%r15), %eax
	leaq	68(%rsp), %rbx
	leaq	64(%rsp), %r13
	leaq	(%rbx,%rax,4), %r9
	.p2align 4,,10
	.p2align 3
.L25:
	movslq	64(%rsp), %rax
	cmpl	$1, %r15d
	jle	.L26
	leaq	0(,%rax,8), %rdx
	movq	%r13, %rcx
	movl	$-1, %r10d
	subq	%rax, %rdx
	movl	280(%rsp,%rdx,8), %edi
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L93:
	je	.L91
	movl	%esi, %edi
.L23:
	addq	$4, %rcx
	cmpq	%r9, %rcx
	je	.L92
.L24:
	movq	(%rcx), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm2, %edx
	pshufd	$225, %xmm0, %xmm1
	movd	%xmm0, %r8d
	movslq	%edx, %rsi
	leaq	0(,%rsi,8), %rax
	subq	%rsi, %rax
	salq	$3, %rax
	movl	280(%rsp,%rax), %esi
	cmpl	%edi, %esi
	jle	.L93
.L22:
	movq	%xmm1, (%rcx)
	xorl	%r10d, %r10d
.L95:
	addq	$4, %rcx
	cmpq	%r9, %rcx
	jne	.L24
.L92:
	testl	%r10d, %r10d
	je	.L25
	movl	64(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L26:
	leal	1(%rax), %edx
	leaq	.LC13(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	cmpl	$1, 36(%rsp)
	movl	$1, %r14d
	leaq	.LC15(%rip), %r12
	leaq	.LC14(%rip), %r13
	jle	.L21
	.p2align 4,,10
	.p2align 3
.L29:
	movslq	-4(%rbx), %rdx
	movslq	(%rbx), %rax
	leaq	0(,%rdx,8), %rcx
	leal	1(%rax), %r8d
	subq	%rdx, %rcx
	leaq	0(,%rax,8), %rdx
	subq	%rax, %rdx
	leaq	0(,%rcx,8), %rsi
	movl	280(%rsp,%rdx,8), %edi
	leaq	0(,%rdx,8), %rax
	movl	%r8d, %edx
	cmpl	%edi, 280(%rsp,%rcx,8)
	jne	.L27
	movq	272(%rsp,%rax), %rax
	cmpq	%rax, 272(%rsp,%rsi)
	je	.L94
.L27:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L28:
	addl	$1, %r14d
	addq	$4, %rbx
	cmpl	%r14d, 36(%rsp)
	jg	.L29
.L21:
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	call	putc@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L91:
	movslq	%r8d, %r11
	movq	272(%rsp,%rax), %rax
	leaq	0(,%r11,8), %rsi
	subq	%r11, %rsi
	movq	272(%rsp,%rsi,8), %rsi
	cmpq	%rax, %rsi
	jg	.L22
	cmpl	%r8d, %edx
	jle	.L23
	cmpq	%rax, %rsi
	jne	.L23
	movq	%xmm1, (%rcx)
	xorl	%r10d, %r10d
	jmp	.L95
	.p2align 4,,10
	.p2align 3
.L11:
	movl	56(%rsp), %edi
	subl	$1, %eax
	addl	$1, %r15d
	cltq
	leaq	0(,%rax,8), %rcx
	leal	-1(%rdi), %edx
	movslq	%edx, %rdx
	subq	%rax, %rcx
	leaq	(%rdx,%rcx,2), %rax
	addl	$1, 284(%rsp,%rax,4)
	cmpl	%r15d, 44(%rsp)
	jg	.L14
	jmp	.L13
.L90:
	testl	%r15d, %r15d
	jle	.L5
	leal	-1(%r15), %edx
	movl	40(%rsp), %ebx
	leaq	284(%rsp), %rcx
	leaq	0(,%rdx,8), %rax
	subq	%rdx, %rax
	leaq	340(%rsp,%rax,8), %r12
	leal	-1(%rbx), %eax
	leaq	4(,%rax,4), %r13
	.p2align 4,,10
	.p2align 3
.L8:
	movq	$0, -12(%rcx)
	movl	$0, -4(%rcx)
	testl	%ebx, %ebx
	jle	.L10
	movq	%rcx, %rdi
	movq	%r13, %rdx
	xorl	%esi, %esi
	call	memset@PLT
	movq	%rax, %rcx
.L10:
	addq	$56, %rcx
	cmpq	%r12, %rcx
	jne	.L8
	testl	%r14d, %r14d
	jg	.L32
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L94:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L28
.L35:
	xorl	%eax, %eax
	jmp	.L16
.L30:
	movq	3080(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L96
	addq	$3096, %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
.L96:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	5
	.long	6
	.long	7
	.align 16
.LC3:
	.long	8
	.long	9
	.long	10
	.long	11
	.align 16
.LC4:
	.long	12
	.long	13
	.long	14
	.long	15
	.align 16
.LC5:
	.long	16
	.long	17
	.long	18
	.long	19
	.align 16
.LC6:
	.long	20
	.long	21
	.long	22
	.long	23
	.align 16
.LC7:
	.long	24
	.long	25
	.long	26
	.long	27
	.align 16
.LC8:
	.long	28
	.long	29
	.long	30
	.long	31
	.align 16
.LC9:
	.long	32
	.long	33
	.long	34
	.long	35
	.align 16
.LC10:
	.long	36
	.long	37
	.long	38
	.long	39
	.align 16
.LC11:
	.long	40
	.long	41
	.long	42
	.long	43
	.align 16
.LC12:
	.long	44
	.long	45
	.long	46
	.long	47
	.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:

/*
  ICPCの解答提出のログが与えられたとき， 各チームの順位を表示
 */

#include <stdio.h>

#define T_MAX 50 // チーム数の上限
#define P_MAX 10 // 問題数の上限

// フラグ
#define SORTED 0 
#define NOT_SORTED -1

/* 構造体Team_score: チームあたりのデータ */
typedef struct {
  long time; // 所要時間
  int num; // 回答問題数
  int penalty[P_MAX]; // 問題
} Team_score;

int main(void) {
  int M, T, P, R; // コンテストの始まりから終わりまでの時間、チーム数、問題数、提出記録の数
  
  while (scanf("%d %d %d %d", &M, &T, &P, &R) != EOF) { // 一行ずつデータを読み込む
    int i, k;
    int m, t, p, j; // 経過時間、チーム番号、問題番号、正誤
    Team_score scores[T_MAX];
    int ranking[T_MAX]; // 順位の順番にチーム番号を格納（ただしチーム番号は-1されている）
    int flag_sorted;
    
    if (M==0 && T==0 && P==0 && R==0) // 終了判定
      break;

    /* チーム記録（構造体）を0で初期化 */
    for (i=0; i<T; i++) {
      scores[i].time = 0;
      scores[i].num = 0;
      for (k=0; k<P; k++) {
	scores[i].penalty[k] = 0;
      }
    }


    /* 提出記録を順番に読み込んで、各チームの正解数、所要時間などを計算 */
    for (i=0; i<R; i++) {
      
      scanf("%d %d %d %d", &m, &t, &p, &j); // 提出記録を読み込む
      if (j == 0) { // もし問題に正解していれば
	scores[t-1].time += m + scores[t-1].penalty[p-1] * 20; // 所要時間を加算
	scores[t-1].num += 1; // 正解問題数をインクリメント
      } else { // もし誤答だったら
	scores[t-1].penalty[p-1] += 1; // 問題あたりの誤答数をインクリメント
      }
    }

    /* 順位を表す配列を初期化 */
    for (i=0; i<T; i++) 
      ranking[i] = i;

    /* 順位付け: 順位の基準にしたがって、チームの順番をソートして順位付け */
    do {
      flag_sorted = NOT_SORTED;
      
      for (k=0; k<=T-2; k++) {
	if (/* 正答数が多いか */
	    (scores[ranking[k]].num < scores[ranking[k+1]].num)
	    /* 正当数は同じであるが、所要時間が短いか */
	    || (scores[ranking[k]].num == scores[ranking[k+1]].num
		&& scores[ranking[k]].time > scores[ranking[k+1]].time)
	    /* 同じ順位であるが、後ろのほうがチーム番号が多いとき */
	    || (scores[ranking[k]].num == scores[ranking[k+1]].num
		&& scores[ranking[k]].time == scores[ranking[k+1]].time
		&& ranking[k] < ranking[k+1])) {
	  /* チーム番号を入れ替え */
	  int tmp = ranking[k];
	  ranking[k] = ranking[k+1];
	  ranking[k+1] = tmp;

	  flag_sorted = SORTED; // 入れ替えられた
	}
      }
    } while (flag_sorted == SORTED); // 入れ替えられなくなったら終了

    /* 順位を表示 */
    printf("%d", ranking[0]+1); // トップのチームの番号を表示 
    for (i=1; i<T; i++) {
      if (scores[ranking[i-1]].num == scores[ranking[i]].num
	  && scores[ranking[i-1]].time == scores[ranking[i]].time) { // 前のチームと同順だったら
	printf("=%d", ranking[i]+1); // '='を使って表示
      } else { //そうでなかったら
	printf(",%d", ranking[i]+1); // ','を使って表示
      }
    }
    putchar('\n');
  }
  
  return 0;
}
300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 2 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 2 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 1 2 0
300 5 8 0
0 0 0 0
 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
13 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 2 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
13 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 2 2 0
240 5 5 7
50 1 1 0
60 2 2 0
41 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 0
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
13 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
 300 10 8 5
50 6 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
 300 10 8 5
50 6 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 2 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
13 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
1 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 2 2 0
240 5 5 7
50 1 1 0
60 2 2 0
41 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
13 2 2 0
60 1 2 0
120 6 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
 300 10 8 5
50 6 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 2 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 1 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0

1,5,3,2,10=9=8=7=6=4
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
 1,5,3,2,10=9=8=7=6=4
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,3=2
5=4=3=2=1
 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
 1,5,3,2,10=9=8=7=6=4
2,1,3,4,5
1,2,3
5=2=1,4=3
2,1
1,2,3
5=4=3=2=1
 1,5,3,2,10=9=8=7=6=4
2,1,3,4,5
1,2,3
5,2=1,4=3
2,1
1,2,3
5=4=3=2=1
 3,5,1,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
 5,1,3,2,10=9=8=7=6=4
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2,1
1,2,3
5=4=3=2=1
 1,5,3,2,10=9=8=7=6=4
2,1,3,4,5
1,2,3
5=2=1,4=3
2,1
1,2,6=5=4=3
5=4=3=2=1
 5,1,3,2,10=9=8=7=6=4
2,1,3,4,5
2,1,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1

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

```c
/*
  ICPCの解答提出のログが与えられたとき， 各チームの順位を表示
 */

#include <stdio.h>

#define T_MAX 50 // チーム数の上限
#define P_MAX 10 // 問題数の上限

// フラグ
#define SORTED 0 
#define NOT_SORTED -1

/* 構造体Team_score: チームあたりのデータ */
typedef struct {
  long time; // 所要時間
  int num; // 回答問題数
  int penalty[P_MAX]; // 問題
} Team_score;

int main(void) {
  int M, T, P, R; // コンテストの始まりから終わりまでの時間、チーム数、問題数、提出記録の数
  
  while (scanf("%d %d %d %d", &M, &T, &P, &R) != EOF) { // 一行ずつデータを読み込む
    int i, k;
    int m, t, p, j; // 経過時間、チーム番号、問題番号、正誤
    Team_score scores[T_MAX];
    int ranking[T_MAX]; // 順位の順番にチーム番号を格納（ただしチーム番号は-1されている）
    int flag_sorted;
    
    if (M==0 && T==0 && P==0 && R==0) // 終了判定
      break;

    /* チーム記録（構造体）を0で初期化 */
    for (i=0; i<T; i++) {
      scores[i].time = 0;
      scores[i].num = 0;
      for (k=0; k<P; k++) {
	scores[i].penalty[k] = 0;
      }
    }


    /* 提出記録を順番に読み込んで、各チームの正解数、所要時間などを計算 */
    for (i=0; i<R; i++) {
      
      scanf("%d %d %d %d", &m, &t, &p, &j); // 提出記録を読み込む
      if (j == 0) { // もし問題に正解していれば
	scores[t-1].time += m + scores[t-1].penalty[p-1] * 20; // 所要時間を加算
	scores[t-1].num += 1; // 正解問題数をインクリメント
      } else { // もし誤答だったら
	scores[t-1].penalty[p-1] += 1; // 問題あたりの誤答数をインクリメント
      }
    }

    /* 順位を表す配列を初期化 */
    for (i=0; i<T; i++) 
      ranking[i] = i;

    /* 順位付け: 順位の基準にしたがって、チームの順番をソートして順位付け */
    do {
      flag_sorted = NOT_SORTED;
      
      for (k=0; k<=T-2; k++) {
	if (/* 正答数が多いか */
	    (scores[ranking[k]].num < scores[ranking[k+1]].num)
	    /* 正当数は同じであるが、所要時間が短いか */
	    || (scores[ranking[k]].num == scores[ranking[k+1]].num
		&& scores[ranking[k]].time > scores[ranking[k+1]].time)
	    /* 同じ順位であるが、後ろのほうがチーム番号が多いとき */
	    || (scores[ranking[k]].num == scores[ranking[k+1]].num
		&& scores[ranking[k]].time == scores[ranking[k+1]].time
		&& ranking[k] < ranking[k+1])) {
	  /* チーム番号を入れ替え */
	  int tmp = ranking[k];
	  ranking[k] = ranking[k+1];
	  ranking[k+1] = tmp;

	  flag_sorted = SORTED; // 入れ替えられた
	}
      }
    } while (flag_sorted == SORTED); // 入れ替えられなくなったら終了

    /* 順位を表示 */
    printf("%d", ranking[0]+1); // トップのチームの番号を表示 
    for (i=1; i<T; i++) {
      if (scores[ranking[i-1]].num == scores[ranking[i]].num
	  && scores[ranking[i-1]].time == scores[ranking[i]].time) { // 前のチームと同順だったら
	printf("=%d", ranking[i]+1); // '='を使って表示
      } else { //そうでなかったら
	printf(",%d", ranking[i]+1); // ','を使って表示
      }
    }
    putchar('\n');
  }
  
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"=%d"
.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	$3072, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L25:
	movl	-3072(%rbp), %eax
	testl	%eax, %eax
	jne	.L3
	movl	-3068(%rbp), %eax
	testl	%eax, %eax
	jne	.L3
	movl	-3064(%rbp), %eax
	testl	%eax, %eax
	jne	.L3
	movl	-3060(%rbp), %eax
	testl	%eax, %eax
	je	.L28
.L3:
	movl	$0, -3040(%rbp)
	jmp	.L5
.L8:
	movl	-3040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	$0, (%rax)
	movl	-3040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	$0, (%rax)
	movl	$0, -3036(%rbp)
	jmp	.L6
.L7:
	movl	-3036(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	$0, -2804(%rbp,%rax,4)
	addl	$1, -3036(%rbp)
.L6:
	movl	-3064(%rbp), %eax
	cmpl	%eax, -3036(%rbp)
	jl	.L7
	addl	$1, -3040(%rbp)
.L5:
	movl	-3068(%rbp), %eax
	cmpl	%eax, -3040(%rbp)
	jl	.L8
	movl	$0, -3040(%rbp)
	jmp	.L9
.L12:
	leaq	-3044(%rbp), %rsi
	leaq	-3048(%rbp), %rcx
	leaq	-3052(%rbp), %rdx
	leaq	-3056(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-3044(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-3052(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rcx
	movl	-3052(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-3048(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	movl	-2804(%rbp,%rax,4), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	sall	$2, %eax
	movl	%eax, %edx
	movl	-3056(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	movl	-3052(%rbp), %eax
	subl	$1, %eax
	addq	%rdx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	%rcx, (%rax)
	movl	-3052(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	movl	-3052(%rbp), %edx
	subl	$1, %edx
	leal	1(%rax), %ecx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	%ecx, (%rax)
	jmp	.L11
.L10:
	movl	-3052(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-3048(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-2804(%rbp,%rax,4), %eax
	movl	-3052(%rbp), %edx
	leal	-1(%rdx), %esi
	movl	-3048(%rbp), %edx
	subl	$1, %edx
	leal	1(%rax), %ecx
	movslq	%edx, %rdi
	movslq	%esi, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	movl	%ecx, -2804(%rbp,%rax,4)
.L11:
	addl	$1, -3040(%rbp)
.L9:
	movl	-3060(%rbp), %eax
	cmpl	%eax, -3040(%rbp)
	jl	.L12
	movl	$0, -3040(%rbp)
	jmp	.L13
.L14:
	movl	-3040(%rbp), %eax
	cltq
	movl	-3040(%rbp), %edx
	movl	%edx, -3024(%rbp,%rax,4)
	addl	$1, -3040(%rbp)
.L13:
	movl	-3068(%rbp), %eax
	cmpl	%eax, -3040(%rbp)
	jl	.L14
.L20:
	movl	$-1, -3032(%rbp)
	movl	$0, -3036(%rbp)
	jmp	.L15
.L19:
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %ecx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jl	.L16
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %ecx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L17
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rcx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rcx
	jg	.L16
.L17:
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %ecx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L18
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rcx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rcx
	jne	.L18
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %edx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L18
.L16:
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movl	%eax, -3028(%rbp)
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %edx
	movl	-3036(%rbp), %eax
	cltq
	movl	%edx, -3024(%rbp,%rax,4)
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3028(%rbp), %edx
	movl	%edx, -3024(%rbp,%rax,4)
	movl	$0, -3032(%rbp)
.L18:
	addl	$1, -3036(%rbp)
.L15:
	movl	-3068(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -3036(%rbp)
	jl	.L19
	cmpl	$0, -3032(%rbp)
	je	.L20
	movl	-3024(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -3040(%rbp)
	jmp	.L21
.L24:
	movl	-3040(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %ecx
	movl	-3040(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L22
	movl	-3040(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rcx
	movl	-3040(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rcx
	jne	.L22
	movl	-3040(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L23
.L22:
	movl	-3040(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L23:
	addl	$1, -3040(%rbp)
.L21:
	movl	-3068(%rbp), %eax
	cmpl	%eax, -3040(%rbp)
	jl	.L24
	movl	$10, %edi
	call	putchar@PLT
.L2:
	leaq	-3060(%rbp), %rsi
	leaq	-3064(%rbp), %rcx
	leaq	-3068(%rbp), %rdx
	leaq	-3072(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L25
	jmp	.L4
.L28:
	nop
.L4:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	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 %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"=%d"
.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	$3072, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L25:
	movl	-3072(%rbp), %eax
	testl	%eax, %eax
	jne	.L3
	movl	-3068(%rbp), %eax
	testl	%eax, %eax
	jne	.L3
	movl	-3064(%rbp), %eax
	testl	%eax, %eax
	jne	.L3
	movl	-3060(%rbp), %eax
	testl	%eax, %eax
	je	.L28
.L3:
	movl	$0, -3040(%rbp)
	jmp	.L5
.L8:
	movl	-3040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	$0, (%rax)
	movl	-3040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	$0, (%rax)
	movl	$0, -3036(%rbp)
	jmp	.L6
.L7:
	movl	-3036(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	$0, -2804(%rbp,%rax,4)
	addl	$1, -3036(%rbp)
.L6:
	movl	-3064(%rbp), %eax
	cmpl	%eax, -3036(%rbp)
	jl	.L7
	addl	$1, -3040(%rbp)
.L5:
	movl	-3068(%rbp), %eax
	cmpl	%eax, -3040(%rbp)
	jl	.L8
	movl	$0, -3040(%rbp)
	jmp	.L9
.L12:
	leaq	-3044(%rbp), %rsi
	leaq	-3048(%rbp), %rcx
	leaq	-3052(%rbp), %rdx
	leaq	-3056(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-3044(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-3052(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rcx
	movl	-3052(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-3048(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	movl	-2804(%rbp,%rax,4), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	sall	$2, %eax
	movl	%eax, %edx
	movl	-3056(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	movl	-3052(%rbp), %eax
	subl	$1, %eax
	addq	%rdx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	%rcx, (%rax)
	movl	-3052(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	movl	-3052(%rbp), %edx
	subl	$1, %edx
	leal	1(%rax), %ecx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	%ecx, (%rax)
	jmp	.L11
.L10:
	movl	-3052(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-3048(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-2804(%rbp,%rax,4), %eax
	movl	-3052(%rbp), %edx
	leal	-1(%rdx), %esi
	movl	-3048(%rbp), %edx
	subl	$1, %edx
	leal	1(%rax), %ecx
	movslq	%edx, %rdi
	movslq	%esi, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	movl	%ecx, -2804(%rbp,%rax,4)
.L11:
	addl	$1, -3040(%rbp)
.L9:
	movl	-3060(%rbp), %eax
	cmpl	%eax, -3040(%rbp)
	jl	.L12
	movl	$0, -3040(%rbp)
	jmp	.L13
.L14:
	movl	-3040(%rbp), %eax
	cltq
	movl	-3040(%rbp), %edx
	movl	%edx, -3024(%rbp,%rax,4)
	addl	$1, -3040(%rbp)
.L13:
	movl	-3068(%rbp), %eax
	cmpl	%eax, -3040(%rbp)
	jl	.L14
.L20:
	movl	$-1, -3032(%rbp)
	movl	$0, -3036(%rbp)
	jmp	.L15
.L19:
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %ecx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jl	.L16
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %ecx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L17
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rcx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rcx
	jg	.L16
.L17:
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %ecx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L18
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rcx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rcx
	jne	.L18
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %edx
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L18
.L16:
	movl	-3036(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movl	%eax, -3028(%rbp)
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %edx
	movl	-3036(%rbp), %eax
	cltq
	movl	%edx, -3024(%rbp,%rax,4)
	movl	-3036(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-3028(%rbp), %edx
	movl	%edx, -3024(%rbp,%rax,4)
	movl	$0, -3032(%rbp)
.L18:
	addl	$1, -3036(%rbp)
.L15:
	movl	-3068(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -3036(%rbp)
	jl	.L19
	cmpl	$0, -3032(%rbp)
	je	.L20
	movl	-3024(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -3040(%rbp)
	jmp	.L21
.L24:
	movl	-3040(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %ecx
	movl	-3040(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2808, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L22
	movl	-3040(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rcx
	movl	-3040(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2816, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rcx
	jne	.L22
	movl	-3040(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L23
.L22:
	movl	-3040(%rbp), %eax
	cltq
	movl	-3024(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L23:
	addl	$1, -3040(%rbp)
.L21:
	movl	-3068(%rbp), %eax
	cmpl	%eax, -3040(%rbp)
	jl	.L24
	movl	$10, %edi
	call	putchar@PLT
.L2:
	leaq	-3060(%rbp), %rsi
	leaq	-3064(%rbp), %rcx
	leaq	-3068(%rbp), %rdx
	leaq	-3072(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L25
	jmp	.L4
.L28:
	nop
.L4:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	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:
