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

```c
// AOJ 1219: Pump up Batteries
// 2017.10.23 bal4u@uu

#include <stdio.h>
#include <string.h>

#define MAX 102
typedef struct { int t, id; } QUE;
QUE que[MAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && (que[l].t < que[i].t ||
		que[l].t == que[i].t && que[l].id < que[i].id)) min = l; else min = i;
	if (r < qsize && (que[r].t < que[min].t ||
		que[r].t == que[min].t && que[r].id < que[min].id)) min = r;
	if (min != i) {
		QUE t = que[i]; que[i] = que[min]; que[min] = t;
		min_heapify(min);
	}
}

int deq(void)
{
	if (qsize == 0) return 0;
//	*t = que[0].t, *id = que[0].id;
	que[0] = que[--qsize];
	min_heapify(0);
	return 1;
}

void enq(int t, int id)
{
	int i, min;

	i = qsize++;
	que[i].t = t, que[i].id = id;
	while (i > 0 && (que[min = PARENT(i)].t > que[i].t ||
		que[min].t == que[i].t && que[min].id > que[i].id)) {
		QUE tt = que[i]; que[i] = que[min]; que[min] = tt;
		i = min;
	}
}

int mque[MAX], top, end, mqsz;
typedef struct { int r, i, n, u[51], c[51]; } T;    // r:remain time
T tbl[MAX], *tp;

int main() 
{
	int n, lim, id, id0, i, t, ans;

	while (scanf("%d%d", &n, &lim) && n > 0) {
		qsize = 0;
		for (tp = tbl, id = 0; id < n; id++, tp++) {
			for (i = 0; scanf("%d", &t) && t > 0; i++) tp->u[i] = t, scanf("%d", &tp->c[i]);
			tp->i = 0, tp->n = i, enq(tp->u[0], id);
		}

		ans = 0, top = end = 0, mqsz = 0;
		for (t = 1; t <= lim; t++) {
			id0 = -1;
			if (mqsz > 0) id0 = mque[top], ans += mqsz - 1;
			while (qsize > 0 && que[0].t == t) {
				id = que[0].id, deq();
				tp = tbl + id, tp->r = tp->c[tp->i];
				mqsz++, mque[end] = id; if (++end == MAX) end = 0;
			}
			if (mqsz == 0) continue;
			if ((id = mque[top]) != id0) continue;
			tp = tbl + id;
			if (--tp->r == 0) {
				if (++tp->i == tp->n) tp->i = 0;
				enq(t + tp->u[tp->i], id);
				mqsz--; if (++top == MAX) top = 0;
			}
		}
		printf("%d\n", ans);
	}
	return 0; 
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	que
	.bss
	.align 32
	.type	que, @object
	.size	que, 816
que:
	.zero	816
	.globl	qsize
	.align 4
	.type	qsize, @object
	.size	qsize, 4
qsize:
	.zero	4
	.text
	.globl	min_heapify
	.type	min_heapify, @function
min_heapify:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	-36(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -16(%rbp)
	movl	-36(%rbp), %eax
	addl	%eax, %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	movl	qsize(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jge	.L2
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L2
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L2
.L3:
	movl	-16(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L4
.L2:
	movl	-36(%rbp), %eax
	movl	%eax, -20(%rbp)
.L4:
	movl	qsize(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L5
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L6
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L5
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L5
.L6:
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
.L5:
	movl	-20(%rbp), %eax
	cmpl	-36(%rbp), %eax
	je	.L8
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	que(%rip), %rax
	movq	(%rsi,%rax), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	min_heapify
.L8:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	min_heapify, .-min_heapify
	.globl	deq
	.type	deq, @function
deq:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	qsize(%rip), %eax
	testl	%eax, %eax
	jne	.L10
	movl	$0, %eax
	jmp	.L11
.L10:
	movl	qsize(%rip), %eax
	subl	$1, %eax
	movl	%eax, qsize(%rip)
	movl	qsize(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, que(%rip)
	movl	$0, %edi
	call	min_heapify
	movl	$1, %eax
.L11:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	deq, .-deq
	.globl	enq
	.type	enq, @function
enq:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	qsize(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, qsize(%rip)
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+que(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L13
.L15:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	que(%rip), %rax
	movq	(%rsi,%rax), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
.L13:
	cmpl	$0, -16(%rbp)
	jle	.L16
	movl	-16(%rbp), %eax
	sarl	%eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jg	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L16
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jg	.L15
.L16:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	enq, .-enq
	.globl	mque
	.bss
	.align 32
	.type	mque, @object
	.size	mque, 408
mque:
	.zero	408
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	mqsz
	.align 4
	.type	mqsz, @object
	.size	mqsz, 4
mqsz:
	.zero	4
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 42840
tbl:
	.zero	42840
	.globl	tp
	.align 8
	.type	tp, @object
	.size	tp, 8
tp:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L18
.L35:
	movl	$0, qsize(%rip)
	leaq	tbl(%rip), %rax
	movq	%rax, tp(%rip)
	movl	$0, -24(%rbp)
	jmp	.L19
.L23:
	movl	$0, -16(%rbp)
	jmp	.L20
.L22:
	movq	tp(%rip), %rax
	movl	-28(%rbp), %ecx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, 12(%rax,%rdx,4)
	movq	tp(%rip), %rdx
	movl	-16(%rbp), %eax
	cltq
	addq	$52, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16(%rbp)
.L20:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L21
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	jg	.L22
.L21:
	movq	tp(%rip), %rax
	movl	$0, 4(%rax)
	movq	tp(%rip), %rax
	movl	-16(%rbp), %edx
	movl	%edx, 8(%rax)
	movq	tp(%rip), %rax
	movl	12(%rax), %eax
	movl	-24(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	enq
	addl	$1, -24(%rbp)
	movq	tp(%rip), %rax
	addq	$420, %rax
	movq	%rax, tp(%rip)
.L19:
	movl	-36(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L23
	movl	$0, -12(%rbp)
	movl	$0, end(%rip)
	movl	end(%rip), %eax
	movl	%eax, top(%rip)
	movl	$0, mqsz(%rip)
	movl	$1, -28(%rbp)
	jmp	.L24
.L33:
	movl	$-1, -20(%rbp)
	movl	mqsz(%rip), %eax
	testl	%eax, %eax
	jle	.L26
	movl	top(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	mque(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
	movl	mqsz(%rip), %eax
	subl	$1, %eax
	addl	%eax, -12(%rbp)
	jmp	.L26
.L28:
	movl	4+que(%rip), %eax
	movl	%eax, -24(%rbp)
	call	deq
	movl	-24(%rbp), %eax
	cltq
	imulq	$420, %rax, %rax
	leaq	tbl(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, tp(%rip)
	movq	tp(%rip), %rdx
	movq	tp(%rip), %rax
	movl	4(%rax), %ecx
	movq	tp(%rip), %rax
	movslq	%ecx, %rcx
	addq	$52, %rcx
	movl	8(%rdx,%rcx,4), %edx
	movl	%edx, (%rax)
	movl	mqsz(%rip), %eax
	addl	$1, %eax
	movl	%eax, mqsz(%rip)
	movl	end(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	mque(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	end(%rip), %eax
	addl	$1, %eax
	movl	%eax, end(%rip)
	movl	end(%rip), %eax
	cmpl	$102, %eax
	jne	.L26
	movl	$0, end(%rip)
.L26:
	movl	qsize(%rip), %eax
	testl	%eax, %eax
	jle	.L27
	movl	que(%rip), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	je	.L28
.L27:
	movl	mqsz(%rip), %eax
	testl	%eax, %eax
	je	.L38
	movl	top(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	mque(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -24(%rbp)
	movl	-24(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jne	.L39
	movl	-24(%rbp), %eax
	cltq
	imulq	$420, %rax, %rax
	leaq	tbl(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, tp(%rip)
	movq	tp(%rip), %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L30
	movq	tp(%rip), %rax
	movl	4(%rax), %edx
	addl	$1, %edx
	movl	%edx, 4(%rax)
	movl	4(%rax), %edx
	movq	tp(%rip), %rax
	movl	8(%rax), %eax
	cmpl	%eax, %edx
	jne	.L32
	movq	tp(%rip), %rax
	movl	$0, 4(%rax)
.L32:
	movq	tp(%rip), %rax
	movq	tp(%rip), %rdx
	movl	4(%rdx), %edx
	movslq	%edx, %rdx
	movl	12(%rax,%rdx,4), %edx
	movl	-28(%rbp), %eax
	addl	%eax, %edx
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	enq
	movl	mqsz(%rip), %eax
	subl	$1, %eax
	movl	%eax, mqsz(%rip)
	movl	top(%rip), %eax
	addl	$1, %eax
	movl	%eax, top(%rip)
	movl	top(%rip), %eax
	cmpl	$102, %eax
	jne	.L30
	movl	$0, top(%rip)
	jmp	.L30
.L38:
	nop
	jmp	.L30
.L39:
	nop
.L30:
	movl	-28(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -28(%rbp)
.L24:
	movl	-28(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L33
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L18:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L34
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jg	.L35
.L34:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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	min_heapify
	.type	min_heapify, @function
min_heapify:
.LFB35:
	.cfi_startproc
	endbr64
	movl	qsize(%rip), %r8d
	leaq	que(%rip), %rdx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L12:
	je	.L11
.L2:
	cmpl	%ecx, %r8d
	jle	.L1
	movl	%edi, %eax
	movslq	%edi, %rsi
.L7:
	movslq	%ecx, %r9
	movl	(%rdx,%rsi,8), %r11d
	cmpl	%r11d, (%rdx,%r9,8)
	jl	.L8
	jne	.L4
	movl	4(%rdx,%rsi,8), %esi
	cmpl	%esi, 4(%rdx,%r9,8)
	cmovl	%ecx, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%edi, %eax
	je	.L1
	movslq	%edi, %rdi
	movslq	%eax, %rcx
	movq	(%rdx,%rdi,8), %rsi
	movq	(%rdx,%rcx,8), %r9
	movq	%r9, (%rdx,%rdi,8)
	movl	%eax, %edi
	movq	%rsi, (%rdx,%rcx,8)
.L6:
	leal	(%rdi,%rdi), %eax
	leal	1(%rax), %ecx
	cmpl	%eax, %r8d
	jle	.L2
	movslq	%edi, %r9
	movslq	%eax, %rsi
	movl	(%rdx,%r9,8), %r10d
	cmpl	%r10d, (%rdx,%rsi,8)
	jge	.L12
	cmpl	%ecx, %r8d
	jle	.L4
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%ecx, %eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L1:
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	movl	4(%rdx,%r9,8), %r10d
	cmpl	%r10d, 4(%rdx,%rsi,8)
	jge	.L2
	cmpl	%ecx, %r8d
	jle	.L4
	jmp	.L7
	.cfi_endproc
.LFE35:
	.size	min_heapify, .-min_heapify
	.p2align 4
	.globl	deq
	.type	deq, @function
deq:
.LFB36:
	.cfi_startproc
	endbr64
	movl	qsize(%rip), %eax
	testl	%eax, %eax
	jne	.L18
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	subl	$1, %eax
	leaq	que(%rip), %rdx
	xorl	%edi, %edi
	movl	%eax, qsize(%rip)
	cltq
	movq	(%rdx,%rax,8), %rax
	movq	%rax, que(%rip)
	call	min_heapify
	movl	$1, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	deq, .-deq
	.p2align 4
	.globl	enq
	.type	enq, @function
enq:
.LFB37:
	.cfi_startproc
	endbr64
	movslq	qsize(%rip), %rcx
	movd	%esi, %xmm1
	movd	%edi, %xmm0
	punpckldq	%xmm1, %xmm0
	leal	1(%rcx), %eax
	movq	%rcx, %rdx
	movl	%eax, qsize(%rip)
	leaq	que(%rip), %rax
	movq	%xmm0, (%rax,%rcx,8)
	testl	%ecx, %ecx
	jle	.L27
	.p2align 4,,10
	.p2align 3
.L20:
	movslq	%edx, %rcx
	sarl	%edx
	movl	(%rax,%rcx,8), %r8d
	movslq	%edx, %rdi
	movd	%r8d, %xmm0
	punpckldq	%xmm1, %xmm0
	cmpl	%r8d, (%rax,%rdi,8)
	jg	.L22
	jne	.L19
	movd	%xmm1, %esi
	cmpl	%esi, 4(%rax,%rdi,8)
	jle	.L19
.L22:
	movq	(%rax,%rdi,8), %r8
	movq	%r8, (%rax,%rcx,8)
	movq	%xmm0, (%rax,%rdi,8)
	testl	%edx, %edx
	jne	.L20
.L19:
	ret
.L27:
	ret
	.cfi_endproc
.LFE37:
	.size	enq, .-enq
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB38:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	que(%rip), %rbx
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	44(%rsp), %rax
	movq	%rax, 16(%rsp)
.L29:
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L48
	movl	44(%rsp), %eax
	testl	%eax, %eax
	jle	.L48
	leaq	tbl(%rip), %r14
	movl	$0, 12(%rsp)
	leaq	52(%rsp), %r15
	movq	%r14, tp(%rip)
	leaq	.LC0(%rip), %r13
	movl	$0, qsize(%rip)
	.p2align 4,,10
	.p2align 3
.L30:
	movl	$216, %r12d
	xorl	%ebp, %ebp
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L59:
	movl	52(%rsp), %eax
	movq	tp(%rip), %r9
	testl	%eax, %eax
	jle	.L31
	movslq	%ebp, %rdx
	leaq	(%r9,%r12), %rsi
	movq	%r13, %rdi
	addl	$1, %ebp
	movl	%eax, 12(%r9,%rdx,4)
	xorl	%eax, %eax
	addq	$4, %r12
	call	__isoc99_scanf@PLT
.L34:
	xorl	%eax, %eax
	movq	%r15, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	jne	.L59
	movq	tp(%rip), %r9
.L31:
	movl	%ebp, 8(%r9)
	movl	12(%rsp), %r10d
	addq	$420, %r9
	movl	$0, -416(%r9)
	movl	-408(%r9), %edi
	movl	%r10d, %esi
	call	enq
	movl	%r10d, %eax
	movq	%r9, tp(%rip)
	addl	$1, %eax
	movl	%eax, 12(%rsp)
	cmpl	%eax, 44(%rsp)
	jg	.L30
	movl	48(%rsp), %edx
	xorl	%r13d, %r13d
	movl	$0, end(%rip)
	movl	$0, top(%rip)
	movl	$0, mqsz(%rip)
	movl	$1, 52(%rsp)
	testl	%edx, %edx
	jle	.L36
	movl	qsize(%rip), %eax
	movl	$1, %edx
	xorl	%r13d, %r13d
	movl	$-1, %r12d
	leaq	mque(%rip), %rbp
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L64:
	cmpl	%edx, (%rbx)
	jne	.L41
	subl	$1, %eax
	movl	4+que(%rip), %r15d
	xorl	%edi, %edi
	movl	%eax, qsize(%rip)
	cltq
	movq	(%rbx,%rax,8), %rax
	movq	%rax, (%rbx)
	call	min_heapify
	movslq	%r15d, %rax
	addl	$1, mqsz(%rip)
	imulq	$420, %rax, %rax
	addq	%r14, %rax
	movslq	4(%rax), %rdx
	movq	%rax, tp(%rip)
	movl	216(%rax,%rdx,4), %edx
	movl	%edx, (%rax)
	movslq	end(%rip), %rdx
	movq	%rdx, %rax
	movl	%r15d, 0(%rbp,%rdx,4)
	addl	$1, %eax
	movl	%eax, end(%rip)
	cmpl	$102, %eax
	je	.L38
.L62:
	movl	52(%rsp), %edx
	movl	qsize(%rip), %eax
.L39:
	testl	%eax, %eax
	jg	.L64
.L41:
	movl	mqsz(%rip), %ecx
	testl	%ecx, %ecx
	je	.L43
	movslq	top(%rip), %rax
	cmpl	%r12d, 0(%rbp,%rax,4)
	jne	.L44
	movslq	%r12d, %rax
	imulq	$420, %rax, %rax
	addq	%r14, %rax
	movl	(%rax), %edi
	movq	%rax, tp(%rip)
	leal	-1(%rdi), %esi
	movl	%esi, (%rax)
	testl	%esi, %esi
	jne	.L44
	movl	4(%rax), %ecx
	addl	$1, %ecx
	cmpl	8(%rax), %ecx
	cmove	%esi, %ecx
	movl	%r12d, %esi
	movl	%ecx, 4(%rax)
	movslq	%ecx, %rcx
	movl	12(%rax,%rcx,4), %edi
	addl	%edx, %edi
	call	enq
	movl	mqsz(%rip), %eax
	leal	-1(%rax), %ecx
	movl	top(%rip), %eax
	movl	%ecx, mqsz(%rip)
	addl	$1, %eax
	movl	%eax, top(%rip)
	cmpl	$102, %eax
	jne	.L63
	movl	$0, top(%rip)
.L63:
	movl	52(%rsp), %edx
.L44:
	addl	$1, %edx
	movl	%edx, 52(%rsp)
	cmpl	48(%rsp), %edx
	jg	.L36
	testl	%ecx, %ecx
	jle	.L52
	movslq	top(%rip), %rax
	leal	-1(%rcx,%r13), %r13d
	movl	0(%rbp,%rax,4), %r12d
	movl	qsize(%rip), %eax
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L38:
	movl	$0, end(%rip)
	jmp	.L62
	.p2align 4,,10
	.p2align 3
.L43:
	addl	$1, %edx
	movl	%edx, 52(%rsp)
	cmpl	%edx, 48(%rsp)
	jl	.L36
	movl	$-1, %r12d
	jmp	.L39
.L36:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L29
.L48:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L65
	addq	$72, %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
.L52:
	.cfi_restore_state
	movl	qsize(%rip), %eax
	orl	$-1, %r12d
	jmp	.L39
.L65:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE38:
	.size	main, .-main
	.globl	tp
	.bss
	.align 8
	.type	tp, @object
	.size	tp, 8
tp:
	.zero	8
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 42840
tbl:
	.zero	42840
	.globl	mqsz
	.align 4
	.type	mqsz, @object
	.size	mqsz, 4
mqsz:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	mque
	.align 32
	.type	mque, @object
	.size	mque, 408
mque:
	.zero	408
	.globl	qsize
	.align 4
	.type	qsize, @object
	.size	qsize, 4
qsize:
	.zero	4
	.globl	que
	.align 32
	.type	que, @object
	.size	que, 816
que:
	.zero	816
	.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	min_heapify
	.type	min_heapify, @function
min_heapify:
.LFB35:
	.cfi_startproc
	endbr64
	movl	qsize(%rip), %r8d
	leaq	que(%rip), %rdx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L12:
	je	.L11
.L2:
	cmpl	%ecx, %r8d
	jle	.L1
	movl	%edi, %eax
	movslq	%edi, %rsi
.L7:
	movslq	%ecx, %r9
	movl	(%rdx,%rsi,8), %r11d
	cmpl	%r11d, (%rdx,%r9,8)
	jl	.L8
	jne	.L4
	movl	4(%rdx,%rsi,8), %esi
	cmpl	%esi, 4(%rdx,%r9,8)
	cmovl	%ecx, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%edi, %eax
	je	.L1
	movslq	%edi, %rdi
	movslq	%eax, %rcx
	movq	(%rdx,%rdi,8), %rsi
	movq	(%rdx,%rcx,8), %r9
	movq	%r9, (%rdx,%rdi,8)
	movl	%eax, %edi
	movq	%rsi, (%rdx,%rcx,8)
.L6:
	leal	(%rdi,%rdi), %eax
	leal	1(%rax), %ecx
	cmpl	%eax, %r8d
	jle	.L2
	movslq	%edi, %r9
	movslq	%eax, %rsi
	movl	(%rdx,%r9,8), %r10d
	cmpl	%r10d, (%rdx,%rsi,8)
	jge	.L12
	cmpl	%ecx, %r8d
	jle	.L4
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%ecx, %eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L1:
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	movl	4(%rdx,%r9,8), %r10d
	cmpl	%r10d, 4(%rdx,%rsi,8)
	jge	.L2
	cmpl	%ecx, %r8d
	jle	.L4
	jmp	.L7
	.cfi_endproc
.LFE35:
	.size	min_heapify, .-min_heapify
	.p2align 4
	.globl	deq
	.type	deq, @function
deq:
.LFB36:
	.cfi_startproc
	endbr64
	movl	qsize(%rip), %eax
	testl	%eax, %eax
	jne	.L18
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	subl	$1, %eax
	leaq	que(%rip), %rdx
	xorl	%edi, %edi
	movl	%eax, qsize(%rip)
	cltq
	movq	(%rdx,%rax,8), %rax
	movq	%rax, que(%rip)
	call	min_heapify
	movl	$1, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	deq, .-deq
	.p2align 4
	.globl	enq
	.type	enq, @function
enq:
.LFB37:
	.cfi_startproc
	endbr64
	movslq	qsize(%rip), %rcx
	movd	%esi, %xmm1
	movd	%edi, %xmm0
	punpckldq	%xmm1, %xmm0
	leal	1(%rcx), %eax
	movq	%rcx, %rdx
	movl	%eax, qsize(%rip)
	leaq	que(%rip), %rax
	movq	%xmm0, (%rax,%rcx,8)
	testl	%ecx, %ecx
	jle	.L27
	.p2align 4,,10
	.p2align 3
.L20:
	movslq	%edx, %rcx
	sarl	%edx
	movl	(%rax,%rcx,8), %r8d
	movslq	%edx, %rdi
	movd	%r8d, %xmm0
	punpckldq	%xmm1, %xmm0
	cmpl	%r8d, (%rax,%rdi,8)
	jg	.L22
	jne	.L19
	movd	%xmm1, %esi
	cmpl	%esi, 4(%rax,%rdi,8)
	jle	.L19
.L22:
	movq	(%rax,%rdi,8), %r8
	movq	%r8, (%rax,%rcx,8)
	movq	%xmm0, (%rax,%rdi,8)
	testl	%edx, %edx
	jne	.L20
.L19:
	ret
.L27:
	ret
	.cfi_endproc
.LFE37:
	.size	enq, .-enq
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB38:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	que(%rip), %rbx
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	44(%rsp), %rax
	movq	%rax, 16(%rsp)
.L29:
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L48
	movl	44(%rsp), %eax
	testl	%eax, %eax
	jle	.L48
	leaq	tbl(%rip), %r14
	movl	$0, 12(%rsp)
	leaq	52(%rsp), %r15
	movq	%r14, tp(%rip)
	leaq	.LC0(%rip), %r13
	movl	$0, qsize(%rip)
	.p2align 4,,10
	.p2align 3
.L30:
	movl	$216, %r12d
	xorl	%ebp, %ebp
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L59:
	movl	52(%rsp), %eax
	movq	tp(%rip), %r9
	testl	%eax, %eax
	jle	.L31
	movslq	%ebp, %rdx
	leaq	(%r9,%r12), %rsi
	movq	%r13, %rdi
	addl	$1, %ebp
	movl	%eax, 12(%r9,%rdx,4)
	xorl	%eax, %eax
	addq	$4, %r12
	call	__isoc99_scanf@PLT
.L34:
	xorl	%eax, %eax
	movq	%r15, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	jne	.L59
	movq	tp(%rip), %r9
.L31:
	movl	%ebp, 8(%r9)
	movl	12(%rsp), %r10d
	addq	$420, %r9
	movl	$0, -416(%r9)
	movl	-408(%r9), %edi
	movl	%r10d, %esi
	call	enq
	movl	%r10d, %eax
	movq	%r9, tp(%rip)
	addl	$1, %eax
	movl	%eax, 12(%rsp)
	cmpl	%eax, 44(%rsp)
	jg	.L30
	movl	48(%rsp), %edx
	xorl	%r13d, %r13d
	movl	$0, end(%rip)
	movl	$0, top(%rip)
	movl	$0, mqsz(%rip)
	movl	$1, 52(%rsp)
	testl	%edx, %edx
	jle	.L36
	movl	qsize(%rip), %eax
	movl	$1, %edx
	xorl	%r13d, %r13d
	movl	$-1, %r12d
	leaq	mque(%rip), %rbp
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L64:
	cmpl	%edx, (%rbx)
	jne	.L41
	subl	$1, %eax
	movl	4+que(%rip), %r15d
	xorl	%edi, %edi
	movl	%eax, qsize(%rip)
	cltq
	movq	(%rbx,%rax,8), %rax
	movq	%rax, (%rbx)
	call	min_heapify
	movslq	%r15d, %rax
	addl	$1, mqsz(%rip)
	imulq	$420, %rax, %rax
	addq	%r14, %rax
	movslq	4(%rax), %rdx
	movq	%rax, tp(%rip)
	movl	216(%rax,%rdx,4), %edx
	movl	%edx, (%rax)
	movslq	end(%rip), %rdx
	movq	%rdx, %rax
	movl	%r15d, 0(%rbp,%rdx,4)
	addl	$1, %eax
	movl	%eax, end(%rip)
	cmpl	$102, %eax
	je	.L38
.L62:
	movl	52(%rsp), %edx
	movl	qsize(%rip), %eax
.L39:
	testl	%eax, %eax
	jg	.L64
.L41:
	movl	mqsz(%rip), %ecx
	testl	%ecx, %ecx
	je	.L43
	movslq	top(%rip), %rax
	cmpl	%r12d, 0(%rbp,%rax,4)
	jne	.L44
	movslq	%r12d, %rax
	imulq	$420, %rax, %rax
	addq	%r14, %rax
	movl	(%rax), %edi
	movq	%rax, tp(%rip)
	leal	-1(%rdi), %esi
	movl	%esi, (%rax)
	testl	%esi, %esi
	jne	.L44
	movl	4(%rax), %ecx
	addl	$1, %ecx
	cmpl	8(%rax), %ecx
	cmove	%esi, %ecx
	movl	%r12d, %esi
	movl	%ecx, 4(%rax)
	movslq	%ecx, %rcx
	movl	12(%rax,%rcx,4), %edi
	addl	%edx, %edi
	call	enq
	movl	mqsz(%rip), %eax
	leal	-1(%rax), %ecx
	movl	top(%rip), %eax
	movl	%ecx, mqsz(%rip)
	addl	$1, %eax
	movl	%eax, top(%rip)
	cmpl	$102, %eax
	jne	.L63
	movl	$0, top(%rip)
.L63:
	movl	52(%rsp), %edx
.L44:
	addl	$1, %edx
	movl	%edx, 52(%rsp)
	cmpl	48(%rsp), %edx
	jg	.L36
	testl	%ecx, %ecx
	jle	.L52
	movslq	top(%rip), %rax
	leal	-1(%rcx,%r13), %r13d
	movl	0(%rbp,%rax,4), %r12d
	movl	qsize(%rip), %eax
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L38:
	movl	$0, end(%rip)
	jmp	.L62
	.p2align 4,,10
	.p2align 3
.L43:
	addl	$1, %edx
	movl	%edx, 52(%rsp)
	cmpl	%edx, 48(%rsp)
	jl	.L36
	movl	$-1, %r12d
	jmp	.L39
.L36:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L29
.L48:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L65
	addq	$72, %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
.L52:
	.cfi_restore_state
	movl	qsize(%rip), %eax
	orl	$-1, %r12d
	jmp	.L39
.L65:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE38:
	.size	main, .-main
	.globl	tp
	.bss
	.align 8
	.type	tp, @object
	.size	tp, 8
tp:
	.zero	8
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 42840
tbl:
	.zero	42840
	.globl	mqsz
	.align 4
	.type	mqsz, @object
	.size	mqsz, 4
mqsz:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	mque
	.align 32
	.type	mque, @object
	.size	mque, 408
mque:
	.zero	408
	.globl	qsize
	.align 4
	.type	qsize, @object
	.size	qsize, 4
qsize:
	.zero	4
	.globl	que
	.align 32
	.type	que, @object
	.size	que, 816
que:
	.zero	816
	.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:

// AOJ 1219: Pump up Batteries
// 2017.10.23 bal4u@uu

#include <stdio.h>
#include <string.h>

#define MAX 102
typedef struct { int t, id; } QUE;
QUE que[MAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && (que[l].t < que[i].t ||
		que[l].t == que[i].t && que[l].id < que[i].id)) min = l; else min = i;
	if (r < qsize && (que[r].t < que[min].t ||
		que[r].t == que[min].t && que[r].id < que[min].id)) min = r;
	if (min != i) {
		QUE t = que[i]; que[i] = que[min]; que[min] = t;
		min_heapify(min);
	}
}

int deq(void)
{
	if (qsize == 0) return 0;
//	*t = que[0].t, *id = que[0].id;
	que[0] = que[--qsize];
	min_heapify(0);
	return 1;
}

void enq(int t, int id)
{
	int i, min;

	i = qsize++;
	que[i].t = t, que[i].id = id;
	while (i > 0 && (que[min = PARENT(i)].t > que[i].t ||
		que[min].t == que[i].t && que[min].id > que[i].id)) {
		QUE tt = que[i]; que[i] = que[min]; que[min] = tt;
		i = min;
	}
}

int mque[MAX], top, end, mqsz;
typedef struct { int r, i, n, u[51], c[51]; } T;    // r:remain time
T tbl[MAX], *tp;

int main() 
{
	int n, lim, id, id0, i, t, ans;

	while (scanf("%d%d", &n, &lim) && n > 0) {
		qsize = 0;
		for (tp = tbl, id = 0; id < n; id++, tp++) {
			for (i = 0; scanf("%d", &t) && t > 0; i++) tp->u[i] = t, scanf("%d", &tp->c[i]);
			tp->i = 0, tp->n = i, enq(tp->u[0], id);
		}

		ans = 0, top = end = 0, mqsz = 0;
		for (t = 1; t <= lim; t++) {
			id0 = -1;
			if (mqsz > 0) id0 = mque[top], ans += mqsz - 1;
			while (qsize > 0 && que[0].t == t) {
				id = que[0].id, deq();
				tp = tbl + id, tp->r = tp->c[tp->i];
				mqsz++, mque[end] = id; if (++end == MAX) end = 0;
			}
			if (mqsz == 0) continue;
			if ((id = mque[top]) != id0) continue;
			tp = tbl + id;
			if (--tp->r == 0) {
				if (++tp->i == tp->n) tp->i = 0;
				enq(t + tp->u[tp->i], id);
				mqsz--; if (++top == MAX) top = 0;
			}
		}
		printf("%d\n", ans);
	}
	return 0; 
}
3 25
3 1 2 1 4 1 0
1 1 0
2 1 3 2 0

4 1000
80 20 80 20 80 20 80 20 0
80
20
0
80 20 90
10 80
20
0
90 9
0

0 0
 3 25
3 1 2 1 4 1 0
1 1 0
2 1 3 2 0

4 1000
80 20 80 40 80 20 80 20 0
80
20
0
80 20 90
10 80
20
0
90 9
0

0 0
 3 25
3 1 2 1 4 1 0
1 1 0
2 1 3 2 0

4 1000
80 20 80 20 80 20 87 20 0
80
20
0
80 20 90
10 80
20
0
90 10
0

0 0
 3 25
3 1 2 1 1 1 0
1 1 0
2 1 3 2 0

4 1000
80 20 80 20 80 20 80 20 0
80
20
0
80 20 90
10 80
20
0
90 9
0

0 0
 3 25
3 1 2 1 4 1 0
1 1 0
2 1 3 2 0

4 1000
79 20 80 40 80 20 80 20 0
80
20
0
80 20 90
10 80
20
0
90 9
0

0 0
 3 25
3 1 2 2 1 1 0
1 1 0
2 1 3 2 0

4 1000
80 20 80 20 80 20 80 20 0
80
20
0
80 20 90
10 80
20
0
90 9
0

0 0
 3 25
3 1 2 1 4 1 0
1 1 0
2 1 3 2 0

4 1000
79 20 80 40 80 20 80 19 0
80
20
0
80 20 90
10 80
20
0
90 9
0

0 0
 3 25
3 1 1 2 1 1 0
1 1 0
2 1 3 2 0

4 1000
80 20 80 20 80 20 80 20 0
80
20
0
80 20 90
10 80
20
0
90 9
0

0 0
 3 22
3 1 2 1 4 1 0
1 1 0
2 1 3 2 0

4 1000
79 20 80 40 80 20 80 19 0
80
20
0
80 20 90
10 80
20
0
90 9
0

0 0
 3 25
3 1 2 1 4 1 0
1 1 0
2 1 3 2 0

4 1000
80 20 80 40 80 20 80 20 0
80
20
0
80 20 90
10 80
20
0
114 9
0

0 0

10
118
 10
238
 10
152
 14
118
 10
232
 17
118
 10
229
 16
118
 9
229
 10
246

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

```c
// AOJ 1219: Pump up Batteries
// 2017.10.23 bal4u@uu

#include <stdio.h>
#include <string.h>

#define MAX 102
typedef struct { int t, id; } QUE;
QUE que[MAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && (que[l].t < que[i].t ||
		que[l].t == que[i].t && que[l].id < que[i].id)) min = l; else min = i;
	if (r < qsize && (que[r].t < que[min].t ||
		que[r].t == que[min].t && que[r].id < que[min].id)) min = r;
	if (min != i) {
		QUE t = que[i]; que[i] = que[min]; que[min] = t;
		min_heapify(min);
	}
}

int deq(void)
{
	if (qsize == 0) return 0;
//	*t = que[0].t, *id = que[0].id;
	que[0] = que[--qsize];
	min_heapify(0);
	return 1;
}

void enq(int t, int id)
{
	int i, min;

	i = qsize++;
	que[i].t = t, que[i].id = id;
	while (i > 0 && (que[min = PARENT(i)].t > que[i].t ||
		que[min].t == que[i].t && que[min].id > que[i].id)) {
		QUE tt = que[i]; que[i] = que[min]; que[min] = tt;
		i = min;
	}
}

int mque[MAX], top, end, mqsz;
typedef struct { int r, i, n, u[51], c[51]; } T;    // r:remain time
T tbl[MAX], *tp;

int main() 
{
	int n, lim, id, id0, i, t, ans;

	while (scanf("%d%d", &n, &lim) && n > 0) {
		qsize = 0;
		for (tp = tbl, id = 0; id < n; id++, tp++) {
			for (i = 0; scanf("%d", &t) && t > 0; i++) tp->u[i] = t, scanf("%d", &tp->c[i]);
			tp->i = 0, tp->n = i, enq(tp->u[0], id);
		}

		ans = 0, top = end = 0, mqsz = 0;
		for (t = 1; t <= lim; t++) {
			id0 = -1;
			if (mqsz > 0) id0 = mque[top], ans += mqsz - 1;
			while (qsize > 0 && que[0].t == t) {
				id = que[0].id, deq();
				tp = tbl + id, tp->r = tp->c[tp->i];
				mqsz++, mque[end] = id; if (++end == MAX) end = 0;
			}
			if (mqsz == 0) continue;
			if ((id = mque[top]) != id0) continue;
			tp = tbl + id;
			if (--tp->r == 0) {
				if (++tp->i == tp->n) tp->i = 0;
				enq(t + tp->u[tp->i], id);
				mqsz--; if (++top == MAX) top = 0;
			}
		}
		printf("%d\n", ans);
	}
	return 0; 
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	que
	.bss
	.align 32
	.type	que, @object
	.size	que, 816
que:
	.zero	816
	.globl	qsize
	.align 4
	.type	qsize, @object
	.size	qsize, 4
qsize:
	.zero	4
	.text
	.globl	min_heapify
	.type	min_heapify, @function
min_heapify:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	-36(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -16(%rbp)
	movl	-36(%rbp), %eax
	addl	%eax, %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	movl	qsize(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jge	.L2
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L2
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L2
.L3:
	movl	-16(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L4
.L2:
	movl	-36(%rbp), %eax
	movl	%eax, -20(%rbp)
.L4:
	movl	qsize(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L5
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L6
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L5
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L5
.L6:
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
.L5:
	movl	-20(%rbp), %eax
	cmpl	-36(%rbp), %eax
	je	.L8
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	que(%rip), %rax
	movq	(%rsi,%rax), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	min_heapify
.L8:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	min_heapify, .-min_heapify
	.globl	deq
	.type	deq, @function
deq:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	qsize(%rip), %eax
	testl	%eax, %eax
	jne	.L10
	movl	$0, %eax
	jmp	.L11
.L10:
	movl	qsize(%rip), %eax
	subl	$1, %eax
	movl	%eax, qsize(%rip)
	movl	qsize(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, que(%rip)
	movl	$0, %edi
	call	min_heapify
	movl	$1, %eax
.L11:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	deq, .-deq
	.globl	enq
	.type	enq, @function
enq:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	qsize(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, qsize(%rip)
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+que(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L13
.L15:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	que(%rip), %rax
	movq	(%rsi,%rax), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
.L13:
	cmpl	$0, -16(%rbp)
	jle	.L16
	movl	-16(%rbp), %eax
	sarl	%eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jg	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L16
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jg	.L15
.L16:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	enq, .-enq
	.globl	mque
	.bss
	.align 32
	.type	mque, @object
	.size	mque, 408
mque:
	.zero	408
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	mqsz
	.align 4
	.type	mqsz, @object
	.size	mqsz, 4
mqsz:
	.zero	4
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 42840
tbl:
	.zero	42840
	.globl	tp
	.align 8
	.type	tp, @object
	.size	tp, 8
tp:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L18
.L35:
	movl	$0, qsize(%rip)
	leaq	tbl(%rip), %rax
	movq	%rax, tp(%rip)
	movl	$0, -24(%rbp)
	jmp	.L19
.L23:
	movl	$0, -16(%rbp)
	jmp	.L20
.L22:
	movq	tp(%rip), %rax
	movl	-28(%rbp), %ecx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, 12(%rax,%rdx,4)
	movq	tp(%rip), %rdx
	movl	-16(%rbp), %eax
	cltq
	addq	$52, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16(%rbp)
.L20:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L21
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	jg	.L22
.L21:
	movq	tp(%rip), %rax
	movl	$0, 4(%rax)
	movq	tp(%rip), %rax
	movl	-16(%rbp), %edx
	movl	%edx, 8(%rax)
	movq	tp(%rip), %rax
	movl	12(%rax), %eax
	movl	-24(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	enq
	addl	$1, -24(%rbp)
	movq	tp(%rip), %rax
	addq	$420, %rax
	movq	%rax, tp(%rip)
.L19:
	movl	-36(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L23
	movl	$0, -12(%rbp)
	movl	$0, end(%rip)
	movl	end(%rip), %eax
	movl	%eax, top(%rip)
	movl	$0, mqsz(%rip)
	movl	$1, -28(%rbp)
	jmp	.L24
.L33:
	movl	$-1, -20(%rbp)
	movl	mqsz(%rip), %eax
	testl	%eax, %eax
	jle	.L26
	movl	top(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	mque(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
	movl	mqsz(%rip), %eax
	subl	$1, %eax
	addl	%eax, -12(%rbp)
	jmp	.L26
.L28:
	movl	4+que(%rip), %eax
	movl	%eax, -24(%rbp)
	call	deq
	movl	-24(%rbp), %eax
	cltq
	imulq	$420, %rax, %rax
	leaq	tbl(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, tp(%rip)
	movq	tp(%rip), %rdx
	movq	tp(%rip), %rax
	movl	4(%rax), %ecx
	movq	tp(%rip), %rax
	movslq	%ecx, %rcx
	addq	$52, %rcx
	movl	8(%rdx,%rcx,4), %edx
	movl	%edx, (%rax)
	movl	mqsz(%rip), %eax
	addl	$1, %eax
	movl	%eax, mqsz(%rip)
	movl	end(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	mque(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	end(%rip), %eax
	addl	$1, %eax
	movl	%eax, end(%rip)
	movl	end(%rip), %eax
	cmpl	$102, %eax
	jne	.L26
	movl	$0, end(%rip)
.L26:
	movl	qsize(%rip), %eax
	testl	%eax, %eax
	jle	.L27
	movl	que(%rip), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	je	.L28
.L27:
	movl	mqsz(%rip), %eax
	testl	%eax, %eax
	je	.L38
	movl	top(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	mque(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -24(%rbp)
	movl	-24(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jne	.L39
	movl	-24(%rbp), %eax
	cltq
	imulq	$420, %rax, %rax
	leaq	tbl(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, tp(%rip)
	movq	tp(%rip), %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L30
	movq	tp(%rip), %rax
	movl	4(%rax), %edx
	addl	$1, %edx
	movl	%edx, 4(%rax)
	movl	4(%rax), %edx
	movq	tp(%rip), %rax
	movl	8(%rax), %eax
	cmpl	%eax, %edx
	jne	.L32
	movq	tp(%rip), %rax
	movl	$0, 4(%rax)
.L32:
	movq	tp(%rip), %rax
	movq	tp(%rip), %rdx
	movl	4(%rdx), %edx
	movslq	%edx, %rdx
	movl	12(%rax,%rdx,4), %edx
	movl	-28(%rbp), %eax
	addl	%eax, %edx
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	enq
	movl	mqsz(%rip), %eax
	subl	$1, %eax
	movl	%eax, mqsz(%rip)
	movl	top(%rip), %eax
	addl	$1, %eax
	movl	%eax, top(%rip)
	movl	top(%rip), %eax
	cmpl	$102, %eax
	jne	.L30
	movl	$0, top(%rip)
	jmp	.L30
.L38:
	nop
	jmp	.L30
.L39:
	nop
.L30:
	movl	-28(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -28(%rbp)
.L24:
	movl	-28(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L33
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L18:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L34
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jg	.L35
.L34:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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	que
	.bss
	.align 32
	.type	que, @object
	.size	que, 816
que:
	.zero	816
	.globl	qsize
	.align 4
	.type	qsize, @object
	.size	qsize, 4
qsize:
	.zero	4
	.text
	.globl	min_heapify
	.type	min_heapify, @function
min_heapify:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	-36(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -16(%rbp)
	movl	-36(%rbp), %eax
	addl	%eax, %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	movl	qsize(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jge	.L2
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L2
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L2
.L3:
	movl	-16(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L4
.L2:
	movl	-36(%rbp), %eax
	movl	%eax, -20(%rbp)
.L4:
	movl	qsize(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L5
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L6
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L5
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L5
.L6:
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
.L5:
	movl	-20(%rbp), %eax
	cmpl	-36(%rbp), %eax
	je	.L8
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	que(%rip), %rax
	movq	(%rsi,%rax), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	min_heapify
.L8:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	min_heapify, .-min_heapify
	.globl	deq
	.type	deq, @function
deq:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	qsize(%rip), %eax
	testl	%eax, %eax
	jne	.L10
	movl	$0, %eax
	jmp	.L11
.L10:
	movl	qsize(%rip), %eax
	subl	$1, %eax
	movl	%eax, qsize(%rip)
	movl	qsize(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, que(%rip)
	movl	$0, %edi
	call	min_heapify
	movl	$1, %eax
.L11:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	deq, .-deq
	.globl	enq
	.type	enq, @function
enq:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	qsize(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, qsize(%rip)
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+que(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L13
.L15:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	que(%rip), %rax
	movq	(%rsi,%rax), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
.L13:
	cmpl	$0, -16(%rbp)
	jle	.L16
	movl	-16(%rbp), %eax
	sarl	%eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jg	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L16
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+que(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+que(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jg	.L15
.L16:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	enq, .-enq
	.globl	mque
	.bss
	.align 32
	.type	mque, @object
	.size	mque, 408
mque:
	.zero	408
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	mqsz
	.align 4
	.type	mqsz, @object
	.size	mqsz, 4
mqsz:
	.zero	4
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 42840
tbl:
	.zero	42840
	.globl	tp
	.align 8
	.type	tp, @object
	.size	tp, 8
tp:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L18
.L35:
	movl	$0, qsize(%rip)
	leaq	tbl(%rip), %rax
	movq	%rax, tp(%rip)
	movl	$0, -24(%rbp)
	jmp	.L19
.L23:
	movl	$0, -16(%rbp)
	jmp	.L20
.L22:
	movq	tp(%rip), %rax
	movl	-28(%rbp), %ecx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, 12(%rax,%rdx,4)
	movq	tp(%rip), %rdx
	movl	-16(%rbp), %eax
	cltq
	addq	$52, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16(%rbp)
.L20:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L21
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	jg	.L22
.L21:
	movq	tp(%rip), %rax
	movl	$0, 4(%rax)
	movq	tp(%rip), %rax
	movl	-16(%rbp), %edx
	movl	%edx, 8(%rax)
	movq	tp(%rip), %rax
	movl	12(%rax), %eax
	movl	-24(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	enq
	addl	$1, -24(%rbp)
	movq	tp(%rip), %rax
	addq	$420, %rax
	movq	%rax, tp(%rip)
.L19:
	movl	-36(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L23
	movl	$0, -12(%rbp)
	movl	$0, end(%rip)
	movl	end(%rip), %eax
	movl	%eax, top(%rip)
	movl	$0, mqsz(%rip)
	movl	$1, -28(%rbp)
	jmp	.L24
.L33:
	movl	$-1, -20(%rbp)
	movl	mqsz(%rip), %eax
	testl	%eax, %eax
	jle	.L26
	movl	top(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	mque(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
	movl	mqsz(%rip), %eax
	subl	$1, %eax
	addl	%eax, -12(%rbp)
	jmp	.L26
.L28:
	movl	4+que(%rip), %eax
	movl	%eax, -24(%rbp)
	call	deq
	movl	-24(%rbp), %eax
	cltq
	imulq	$420, %rax, %rax
	leaq	tbl(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, tp(%rip)
	movq	tp(%rip), %rdx
	movq	tp(%rip), %rax
	movl	4(%rax), %ecx
	movq	tp(%rip), %rax
	movslq	%ecx, %rcx
	addq	$52, %rcx
	movl	8(%rdx,%rcx,4), %edx
	movl	%edx, (%rax)
	movl	mqsz(%rip), %eax
	addl	$1, %eax
	movl	%eax, mqsz(%rip)
	movl	end(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	mque(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	end(%rip), %eax
	addl	$1, %eax
	movl	%eax, end(%rip)
	movl	end(%rip), %eax
	cmpl	$102, %eax
	jne	.L26
	movl	$0, end(%rip)
.L26:
	movl	qsize(%rip), %eax
	testl	%eax, %eax
	jle	.L27
	movl	que(%rip), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	je	.L28
.L27:
	movl	mqsz(%rip), %eax
	testl	%eax, %eax
	je	.L38
	movl	top(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	mque(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -24(%rbp)
	movl	-24(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jne	.L39
	movl	-24(%rbp), %eax
	cltq
	imulq	$420, %rax, %rax
	leaq	tbl(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, tp(%rip)
	movq	tp(%rip), %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L30
	movq	tp(%rip), %rax
	movl	4(%rax), %edx
	addl	$1, %edx
	movl	%edx, 4(%rax)
	movl	4(%rax), %edx
	movq	tp(%rip), %rax
	movl	8(%rax), %eax
	cmpl	%eax, %edx
	jne	.L32
	movq	tp(%rip), %rax
	movl	$0, 4(%rax)
.L32:
	movq	tp(%rip), %rax
	movq	tp(%rip), %rdx
	movl	4(%rdx), %edx
	movslq	%edx, %rdx
	movl	12(%rax,%rdx,4), %edx
	movl	-28(%rbp), %eax
	addl	%eax, %edx
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	enq
	movl	mqsz(%rip), %eax
	subl	$1, %eax
	movl	%eax, mqsz(%rip)
	movl	top(%rip), %eax
	addl	$1, %eax
	movl	%eax, top(%rip)
	movl	top(%rip), %eax
	cmpl	$102, %eax
	jne	.L30
	movl	$0, top(%rip)
	jmp	.L30
.L38:
	nop
	jmp	.L30
.L39:
	nop
.L30:
	movl	-28(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -28(%rbp)
.L24:
	movl	-28(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L33
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L18:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L34
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jg	.L35
.L34:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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:
