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

```c
#include<stdio.h>
#define MAX 100001
 
 struct P{
          char name[10];
          int time;
          };

 struct P q[MAX];
 int head,tail;

 int init(){
        return head=tail=0;
        }

 int empty(){
        return head==tail;
        }

 int full(){
        return head==(tail+1)%MAX;
        }

 void enqueue(struct P x){
        if(full())return;

        q[tail]=x;
        tail=(tail+1)%MAX;
        }

 struct P dequeue(){
        if(empty())return;

        struct P x=q[head];
        head=(head+1)%MAX;
        return x;
        }

 int main(){
      int n,lim,ttt,sum=0,i;
      init();
      scanf("%d%d",&n,&lim);
      for(i=0;i<n;i++){
                scanf("%s %d",&q[i].name,&q[i].time);
                }
      head=0;tail=n;
      while(head != tail){
                     struct P c=dequeue();
                     ttt=(c.time<lim)?c.time:lim;
                     c.time-=ttt;
                     sum+=ttt;
                     if(c.time>0)enqueue(c);
                     else {printf("%s %d\n",c.name,sum);}
                     }
      return 0;
      }




      
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	q
	.bss
	.align 32
	.type	q, @object
	.size	q, 1600016
q:
	.zero	1600016
	.globl	head
	.align 4
	.type	head, @object
	.size	head, 4
head:
	.zero	4
	.globl	tail
	.align 4
	.type	tail, @object
	.size	tail, 4
tail:
	.zero	4
	.text
	.globl	init
	.type	init, @function
init:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, tail(%rip)
	movl	tail(%rip), %eax
	movl	%eax, head(%rip)
	movl	head(%rip), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	init, .-init
	.globl	empty
	.type	empty, @function
empty:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	head(%rip), %edx
	movl	tail(%rip), %eax
	cmpl	%eax, %edx
	sete	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	empty, .-empty
	.globl	full
	.type	full, @function
full:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	tail(%rip), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	imulq	$703680405, %rax, %rax
	shrq	$32, %rax
	sarl	$14, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$100001, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	head(%rip), %edx
	cmpl	%edx, %eax
	sete	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	full, .-full
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, %rdx
	movq	%rsi, %rax
	movq	%rdx, -16(%rbp)
	movq	%rax, -8(%rbp)
	movl	$0, %eax
	call	full
	testl	%eax, %eax
	jne	.L10
	movl	tail(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	q(%rip), %rcx
	movq	-16(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movl	tail(%rip), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	imulq	$703680405, %rax, %rax
	shrq	$32, %rax
	sarl	$14, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$100001, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, tail(%rip)
	jmp	.L7
.L10:
	nop
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	enqueue, .-enqueue
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r13
	pushq	%r12
	subq	$64, %rsp
	.cfi_offset 13, -24
	.cfi_offset 12, -32
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$0, %eax
	call	empty
	testl	%eax, %eax
	jne	.L17
	movl	head(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	q(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, -64(%rbp)
	movq	%rdx, -56(%rbp)
	movl	head(%rip), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	imulq	$703680405, %rax, %rax
	shrq	$32, %rax
	sarl	$14, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$100001, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, head(%rip)
	movq	-64(%rbp), %rax
	movq	-56(%rbp), %rdx
	movq	%rax, -48(%rbp)
	movq	%rdx, -40(%rbp)
	movq	-48(%rbp), %rax
	movq	-40(%rbp), %rdx
	movq	%rax, %r12
	movq	%rdx, %r13
	jmp	.L11
.L17:
	nop
	nop
.L11:
	movq	-24(%rbp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	movq	%r12, %rax
	movq	%r13, %rdx
	addq	$64, %rsp
	popq	%r12
	popq	%r13
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	dequeue, .-dequeue
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -44(%rbp)
	movl	$0, %eax
	call	init
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40(%rbp)
	jmp	.L19
.L20:
	movl	-40(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	q(%rip), %rax
	addq	%rdx, %rax
	leaq	12(%rax), %rdx
	movl	-40(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	q(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40(%rbp)
.L19:
	movl	-52(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L20
	movl	$0, head(%rip)
	movl	-52(%rbp), %eax
	movl	%eax, tail(%rip)
	jmp	.L21
.L24:
	movl	$0, %eax
	call	dequeue
	movq	%rax, -32(%rbp)
	movq	%rdx, -24(%rbp)
	movl	-20(%rbp), %edx
	movl	-48(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -36(%rbp)
	movl	-20(%rbp), %eax
	subl	-36(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-36(%rbp), %eax
	addl	%eax, -44(%rbp)
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L22
	movq	-32(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rdi
	movq	%rax, %rsi
	call	enqueue
	jmp	.L21
.L22:
	movl	-44(%rbp), %edx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L21:
	movl	head(%rip), %edx
	movl	tail(%rip), %eax
	cmpl	%eax, %edx
	jne	.L24
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.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	init
	.type	init, @function
init:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$0, tail(%rip)
	xorl	%eax, %eax
	movl	$0, head(%rip)
	ret
	.cfi_endproc
.LFE23:
	.size	init, .-init
	.p2align 4
	.globl	empty
	.type	empty, @function
empty:
.LFB24:
	.cfi_startproc
	endbr64
	movl	tail(%rip), %eax
	cmpl	%eax, head(%rip)
	sete	%al
	movzbl	%al, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	empty, .-empty
	.p2align 4
	.globl	full
	.type	full, @function
full:
.LFB25:
	.cfi_startproc
	endbr64
	movl	tail(%rip), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	movl	%edx, %ecx
	imulq	$703680405, %rax, %rax
	sarl	$31, %ecx
	sarq	$46, %rax
	subl	%ecx, %eax
	imull	$100001, %eax, %eax
	subl	%eax, %edx
	xorl	%eax, %eax
	cmpl	head(%rip), %edx
	sete	%al
	ret
	.cfi_endproc
.LFE25:
	.size	full, .-full
	.p2align 4
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB26:
	.cfi_startproc
	endbr64
	movslq	tail(%rip), %rdx
	movq	%rsi, -16(%rsp)
	movq	%rdi, -24(%rsp)
	leal	1(%rdx), %ecx
	movslq	%ecx, %rax
	movl	%ecx, %esi
	imulq	$703680405, %rax, %rax
	sarl	$31, %esi
	sarq	$46, %rax
	subl	%esi, %eax
	imull	$100001, %eax, %esi
	movl	%ecx, %eax
	subl	%esi, %eax
	cmpl	head(%rip), %eax
	je	.L5
	movdqu	-24(%rsp), %xmm0
	movl	%eax, tail(%rip)
	salq	$4, %rdx
	leaq	q(%rip), %rcx
	movaps	%xmm0, (%rcx,%rdx)
.L5:
	ret
	.cfi_endproc
.LFE26:
	.size	enqueue, .-enqueue
	.p2align 4
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB27:
	.cfi_startproc
	endbr64
	subq	$72, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	movl	head(%rip), %eax
	cmpl	tail(%rip), %eax
	je	.L7
	movslq	%eax, %rcx
	addl	$1, %eax
	movslq	%eax, %rdx
	movl	%eax, %esi
	salq	$4, %rcx
	imulq	$703680405, %rdx, %rdx
	sarl	$31, %esi
	sarq	$46, %rdx
	subl	%esi, %edx
	imull	$100001, %edx, %edx
	subl	%edx, %eax
	movl	%eax, head(%rip)
	leaq	q(%rip), %rax
	movq	(%rax,%rcx), %rsi
	movq	8(%rax,%rcx), %rdi
.L7:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L11
	movq	%rsi, %rax
	movq	%rdi, %rdx
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE27:
	.size	dequeue, .-dequeue
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB28:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$80, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	12(%rsp), %rdx
	movl	$0, tail(%rip)
	movl	$0, head(%rip)
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	testl	%esi, %esi
	jle	.L13
	leaq	q(%rip), %rbx
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbx, %rsi
	leaq	12(%rbx), %rdx
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	addl	$1, %ebp
	addq	$16, %rbx
	cmpl	%ebp, %esi
	jg	.L14
.L13:
	movl	$0, head(%rip)
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	leaq	q(%rip), %rbp
	movl	%esi, tail(%rip)
	leaq	.LC2(%rip), %r12
	testl	%esi, %esi
	jne	.L15
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L29:
	leal	1(%rsi), %ecx
	movdqa	16(%rsp), %xmm0
	movslq	%ecx, %rdx
	movl	%ecx, %edi
	imulq	$703680405, %rdx, %rdx
	sarl	$31, %edi
	movaps	%xmm0, 48(%rsp)
	sarq	$46, %rdx
	subl	%edi, %edx
	imull	$100001, %edx, %edi
	subl	%edi, %ecx
	cmpl	%ecx, %eax
	je	.L28
	salq	$4, %rsi
	movl	%ecx, tail(%rip)
	movaps	%xmm0, 0(%rbp,%rsi)
	movslq	%ecx, %rsi
	cmpl	%esi, %eax
	je	.L20
.L15:
	movslq	%eax, %rdx
	salq	$4, %rdx
	movdqa	0(%rbp,%rdx), %xmm0
	leal	1(%rax), %edx
	movslq	%edx, %rax
	movl	%edx, %ecx
	imulq	$703680405, %rax, %rax
	sarl	$31, %ecx
	movaps	%xmm0, 16(%rsp)
	movaps	%xmm0, 48(%rsp)
	sarq	$46, %rax
	subl	%ecx, %eax
	imull	$100001, %eax, %ecx
	movl	%edx, %eax
	movl	28(%rsp), %edx
	subl	%ecx, %eax
	movl	12(%rsp), %ecx
	movl	%eax, head(%rip)
	cmpl	%ecx, %edx
	cmovle	%edx, %ecx
	subl	%ecx, %edx
	addl	%ecx, %ebx
	movl	%edx, 28(%rsp)
	testl	%edx, %edx
	jg	.L29
	leaq	16(%rsp), %rdx
	movl	%ebx, %ecx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	head(%rip), %eax
.L28:
	movslq	tail(%rip), %rsi
	cmpl	%esi, %eax
	jne	.L15
.L20:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$80, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE28:
	.size	main, .-main
	.globl	tail
	.bss
	.align 4
	.type	tail, @object
	.size	tail, 4
tail:
	.zero	4
	.globl	head
	.align 4
	.type	head, @object
	.size	head, 4
head:
	.zero	4
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 1600016
q:
	.zero	1600016
	.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	init
	.type	init, @function
init:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$0, tail(%rip)
	xorl	%eax, %eax
	movl	$0, head(%rip)
	ret
	.cfi_endproc
.LFE23:
	.size	init, .-init
	.p2align 4
	.globl	empty
	.type	empty, @function
empty:
.LFB24:
	.cfi_startproc
	endbr64
	movl	tail(%rip), %eax
	cmpl	%eax, head(%rip)
	sete	%al
	movzbl	%al, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	empty, .-empty
	.p2align 4
	.globl	full
	.type	full, @function
full:
.LFB25:
	.cfi_startproc
	endbr64
	movl	tail(%rip), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	movl	%edx, %ecx
	imulq	$703680405, %rax, %rax
	sarl	$31, %ecx
	sarq	$46, %rax
	subl	%ecx, %eax
	imull	$100001, %eax, %eax
	subl	%eax, %edx
	xorl	%eax, %eax
	cmpl	head(%rip), %edx
	sete	%al
	ret
	.cfi_endproc
.LFE25:
	.size	full, .-full
	.p2align 4
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB26:
	.cfi_startproc
	endbr64
	movslq	tail(%rip), %rdx
	movq	%rsi, -16(%rsp)
	movq	%rdi, -24(%rsp)
	leal	1(%rdx), %ecx
	movslq	%ecx, %rax
	movl	%ecx, %esi
	imulq	$703680405, %rax, %rax
	sarl	$31, %esi
	sarq	$46, %rax
	subl	%esi, %eax
	imull	$100001, %eax, %esi
	movl	%ecx, %eax
	subl	%esi, %eax
	cmpl	head(%rip), %eax
	je	.L5
	movdqu	-24(%rsp), %xmm0
	movl	%eax, tail(%rip)
	salq	$4, %rdx
	leaq	q(%rip), %rcx
	movaps	%xmm0, (%rcx,%rdx)
.L5:
	ret
	.cfi_endproc
.LFE26:
	.size	enqueue, .-enqueue
	.p2align 4
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB27:
	.cfi_startproc
	endbr64
	subq	$72, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	movl	head(%rip), %eax
	cmpl	tail(%rip), %eax
	je	.L7
	movslq	%eax, %rcx
	addl	$1, %eax
	movslq	%eax, %rdx
	movl	%eax, %esi
	salq	$4, %rcx
	imulq	$703680405, %rdx, %rdx
	sarl	$31, %esi
	sarq	$46, %rdx
	subl	%esi, %edx
	imull	$100001, %edx, %edx
	subl	%edx, %eax
	movl	%eax, head(%rip)
	leaq	q(%rip), %rax
	movq	(%rax,%rcx), %rsi
	movq	8(%rax,%rcx), %rdi
.L7:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L11
	movq	%rsi, %rax
	movq	%rdi, %rdx
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE27:
	.size	dequeue, .-dequeue
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB28:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$80, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	12(%rsp), %rdx
	movl	$0, tail(%rip)
	movl	$0, head(%rip)
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	testl	%esi, %esi
	jle	.L13
	leaq	q(%rip), %rbx
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbx, %rsi
	leaq	12(%rbx), %rdx
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	addl	$1, %ebp
	addq	$16, %rbx
	cmpl	%ebp, %esi
	jg	.L14
.L13:
	movl	$0, head(%rip)
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	leaq	q(%rip), %rbp
	movl	%esi, tail(%rip)
	leaq	.LC2(%rip), %r12
	testl	%esi, %esi
	jne	.L15
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L29:
	leal	1(%rsi), %ecx
	movdqa	16(%rsp), %xmm0
	movslq	%ecx, %rdx
	movl	%ecx, %edi
	imulq	$703680405, %rdx, %rdx
	sarl	$31, %edi
	movaps	%xmm0, 48(%rsp)
	sarq	$46, %rdx
	subl	%edi, %edx
	imull	$100001, %edx, %edi
	subl	%edi, %ecx
	cmpl	%ecx, %eax
	je	.L28
	salq	$4, %rsi
	movl	%ecx, tail(%rip)
	movaps	%xmm0, 0(%rbp,%rsi)
	movslq	%ecx, %rsi
	cmpl	%esi, %eax
	je	.L20
.L15:
	movslq	%eax, %rdx
	salq	$4, %rdx
	movdqa	0(%rbp,%rdx), %xmm0
	leal	1(%rax), %edx
	movslq	%edx, %rax
	movl	%edx, %ecx
	imulq	$703680405, %rax, %rax
	sarl	$31, %ecx
	movaps	%xmm0, 16(%rsp)
	movaps	%xmm0, 48(%rsp)
	sarq	$46, %rax
	subl	%ecx, %eax
	imull	$100001, %eax, %ecx
	movl	%edx, %eax
	movl	28(%rsp), %edx
	subl	%ecx, %eax
	movl	12(%rsp), %ecx
	movl	%eax, head(%rip)
	cmpl	%ecx, %edx
	cmovle	%edx, %ecx
	subl	%ecx, %edx
	addl	%ecx, %ebx
	movl	%edx, 28(%rsp)
	testl	%edx, %edx
	jg	.L29
	leaq	16(%rsp), %rdx
	movl	%ebx, %ecx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	head(%rip), %eax
.L28:
	movslq	tail(%rip), %rsi
	cmpl	%esi, %eax
	jne	.L15
.L20:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$80, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE28:
	.size	main, .-main
	.globl	tail
	.bss
	.align 4
	.type	tail, @object
	.size	tail, 4
tail:
	.zero	4
	.globl	head
	.align 4
	.type	head, @object
	.size	head, 4
head:
	.zero	4
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 1600016
q:
	.zero	1600016
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include<stdio.h>
#define MAX 100001
 
 struct P{
          char name[10];
          int time;
          };

 struct P q[MAX];
 int head,tail;

 int init(){
        return head=tail=0;
        }

 int empty(){
        return head==tail;
        }

 int full(){
        return head==(tail+1)%MAX;
        }

 void enqueue(struct P x){
        if(full())return;

        q[tail]=x;
        tail=(tail+1)%MAX;
        }

 struct P dequeue(){
        if(empty())return;

        struct P x=q[head];
        head=(head+1)%MAX;
        return x;
        }

 int main(){
      int n,lim,ttt,sum=0,i;
      init();
      scanf("%d%d",&n,&lim);
      for(i=0;i<n;i++){
                scanf("%s %d",&q[i].name,&q[i].time);
                }
      head=0;tail=n;
      while(head != tail){
                     struct P c=dequeue();
                     ttt=(c.time<lim)?c.time:lim;
                     c.time-=ttt;
                     sum+=ttt;
                     if(c.time>0)enqueue(c);
                     else {printf("%s %d\n",c.name,sum);}
                     }
      return 0;
      }




      

5 100
p1 150
p2 80
p3 200
p4 350
p5 14
 5 100
p1 150
2p 80
p3 200
p4 350
p5 14
 4 100
p1 150
2p 80
p3 200
p4 350
p5 14
 3 100
p1 150
2p 80
p3 200
p4 350
p5 14
 5 100
p1 150
p2 125
p3 200
p4 350
p5 20
 4 100
p1 150
p2 80
p3 200
p4 350
p5 14
 5 100
p1 150
2p 80
3p 200
p4 350
p5 14
 4 100
p1 150
2p 80
p2 200
p4 350
p5 14
 3 100
p1 150
p2 80
p3 200
p4 350
p5 14
 5 100
p1 150
p2 216
p3 200
p4 350
p5 20

p2 180
p5 394
p1 444
p3 544
p4 794
 2p 180
p5 394
p1 444
p3 544
p4 794
 2p 180
p1 430
p3 530
p4 780
 2p 180
p1 330
p3 430
 p5 420
p1 470
p2 495
p3 595
p4 845
 p2 180
p1 430
p3 530
p4 780
 2p 180
p5 394
p1 444
3p 544
p4 794
 2p 180
p1 430
p2 530
p4 780
 p2 180
p1 330
p3 430
 p5 420
p1 470
p3 670
p2 786
p4 936

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

```c
#include<stdio.h>
#define MAX 100001
 
 struct P{
          char name[10];
          int time;
          };

 struct P q[MAX];
 int head,tail;

 int init(){
        return head=tail=0;
        }

 int empty(){
        return head==tail;
        }

 int full(){
        return head==(tail+1)%MAX;
        }

 void enqueue(struct P x){
        if(full())return;

        q[tail]=x;
        tail=(tail+1)%MAX;
        }

 struct P dequeue(){
        if(empty())return;

        struct P x=q[head];
        head=(head+1)%MAX;
        return x;
        }

 int main(){
      int n,lim,ttt,sum=0,i;
      init();
      scanf("%d%d",&n,&lim);
      for(i=0;i<n;i++){
                scanf("%s %d",&q[i].name,&q[i].time);
                }
      head=0;tail=n;
      while(head != tail){
                     struct P c=dequeue();
                     ttt=(c.time<lim)?c.time:lim;
                     c.time-=ttt;
                     sum+=ttt;
                     if(c.time>0)enqueue(c);
                     else {printf("%s %d\n",c.name,sum);}
                     }
      return 0;
      }




      
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	q
	.bss
	.align 32
	.type	q, @object
	.size	q, 1600016
q:
	.zero	1600016
	.globl	head
	.align 4
	.type	head, @object
	.size	head, 4
head:
	.zero	4
	.globl	tail
	.align 4
	.type	tail, @object
	.size	tail, 4
tail:
	.zero	4
	.text
	.globl	init
	.type	init, @function
init:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, tail(%rip)
	movl	tail(%rip), %eax
	movl	%eax, head(%rip)
	movl	head(%rip), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	init, .-init
	.globl	empty
	.type	empty, @function
empty:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	head(%rip), %edx
	movl	tail(%rip), %eax
	cmpl	%eax, %edx
	sete	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	empty, .-empty
	.globl	full
	.type	full, @function
full:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	tail(%rip), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	imulq	$703680405, %rax, %rax
	shrq	$32, %rax
	sarl	$14, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$100001, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	head(%rip), %edx
	cmpl	%edx, %eax
	sete	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	full, .-full
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, %rdx
	movq	%rsi, %rax
	movq	%rdx, -16(%rbp)
	movq	%rax, -8(%rbp)
	movl	$0, %eax
	call	full
	testl	%eax, %eax
	jne	.L10
	movl	tail(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	q(%rip), %rcx
	movq	-16(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movl	tail(%rip), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	imulq	$703680405, %rax, %rax
	shrq	$32, %rax
	sarl	$14, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$100001, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, tail(%rip)
	jmp	.L7
.L10:
	nop
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	enqueue, .-enqueue
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r13
	pushq	%r12
	subq	$64, %rsp
	.cfi_offset 13, -24
	.cfi_offset 12, -32
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$0, %eax
	call	empty
	testl	%eax, %eax
	jne	.L17
	movl	head(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	q(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, -64(%rbp)
	movq	%rdx, -56(%rbp)
	movl	head(%rip), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	imulq	$703680405, %rax, %rax
	shrq	$32, %rax
	sarl	$14, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$100001, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, head(%rip)
	movq	-64(%rbp), %rax
	movq	-56(%rbp), %rdx
	movq	%rax, -48(%rbp)
	movq	%rdx, -40(%rbp)
	movq	-48(%rbp), %rax
	movq	-40(%rbp), %rdx
	movq	%rax, %r12
	movq	%rdx, %r13
	jmp	.L11
.L17:
	nop
	nop
.L11:
	movq	-24(%rbp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	movq	%r12, %rax
	movq	%r13, %rdx
	addq	$64, %rsp
	popq	%r12
	popq	%r13
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	dequeue, .-dequeue
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -44(%rbp)
	movl	$0, %eax
	call	init
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40(%rbp)
	jmp	.L19
.L20:
	movl	-40(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	q(%rip), %rax
	addq	%rdx, %rax
	leaq	12(%rax), %rdx
	movl	-40(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	q(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40(%rbp)
.L19:
	movl	-52(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L20
	movl	$0, head(%rip)
	movl	-52(%rbp), %eax
	movl	%eax, tail(%rip)
	jmp	.L21
.L24:
	movl	$0, %eax
	call	dequeue
	movq	%rax, -32(%rbp)
	movq	%rdx, -24(%rbp)
	movl	-20(%rbp), %edx
	movl	-48(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -36(%rbp)
	movl	-20(%rbp), %eax
	subl	-36(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-36(%rbp), %eax
	addl	%eax, -44(%rbp)
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L22
	movq	-32(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rdi
	movq	%rax, %rsi
	call	enqueue
	jmp	.L21
.L22:
	movl	-44(%rbp), %edx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L21:
	movl	head(%rip), %edx
	movl	tail(%rip), %eax
	cmpl	%eax, %edx
	jne	.L24
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.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	q
	.bss
	.align 32
	.type	q, @object
	.size	q, 1600016
q:
	.zero	1600016
	.globl	head
	.align 4
	.type	head, @object
	.size	head, 4
head:
	.zero	4
	.globl	tail
	.align 4
	.type	tail, @object
	.size	tail, 4
tail:
	.zero	4
	.text
	.globl	init
	.type	init, @function
init:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, tail(%rip)
	movl	tail(%rip), %eax
	movl	%eax, head(%rip)
	movl	head(%rip), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	init, .-init
	.globl	empty
	.type	empty, @function
empty:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	head(%rip), %edx
	movl	tail(%rip), %eax
	cmpl	%eax, %edx
	sete	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	empty, .-empty
	.globl	full
	.type	full, @function
full:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	tail(%rip), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	imulq	$703680405, %rax, %rax
	shrq	$32, %rax
	sarl	$14, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$100001, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	head(%rip), %edx
	cmpl	%edx, %eax
	sete	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	full, .-full
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, %rdx
	movq	%rsi, %rax
	movq	%rdx, -16(%rbp)
	movq	%rax, -8(%rbp)
	movl	$0, %eax
	call	full
	testl	%eax, %eax
	jne	.L10
	movl	tail(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	q(%rip), %rcx
	movq	-16(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movl	tail(%rip), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	imulq	$703680405, %rax, %rax
	shrq	$32, %rax
	sarl	$14, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$100001, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, tail(%rip)
	jmp	.L7
.L10:
	nop
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	enqueue, .-enqueue
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r13
	pushq	%r12
	subq	$64, %rsp
	.cfi_offset 13, -24
	.cfi_offset 12, -32
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$0, %eax
	call	empty
	testl	%eax, %eax
	jne	.L17
	movl	head(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	q(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, -64(%rbp)
	movq	%rdx, -56(%rbp)
	movl	head(%rip), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	imulq	$703680405, %rax, %rax
	shrq	$32, %rax
	sarl	$14, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$100001, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, head(%rip)
	movq	-64(%rbp), %rax
	movq	-56(%rbp), %rdx
	movq	%rax, -48(%rbp)
	movq	%rdx, -40(%rbp)
	movq	-48(%rbp), %rax
	movq	-40(%rbp), %rdx
	movq	%rax, %r12
	movq	%rdx, %r13
	jmp	.L11
.L17:
	nop
	nop
.L11:
	movq	-24(%rbp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	movq	%r12, %rax
	movq	%r13, %rdx
	addq	$64, %rsp
	popq	%r12
	popq	%r13
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	dequeue, .-dequeue
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -44(%rbp)
	movl	$0, %eax
	call	init
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40(%rbp)
	jmp	.L19
.L20:
	movl	-40(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	q(%rip), %rax
	addq	%rdx, %rax
	leaq	12(%rax), %rdx
	movl	-40(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	q(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40(%rbp)
.L19:
	movl	-52(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L20
	movl	$0, head(%rip)
	movl	-52(%rbp), %eax
	movl	%eax, tail(%rip)
	jmp	.L21
.L24:
	movl	$0, %eax
	call	dequeue
	movq	%rax, -32(%rbp)
	movq	%rdx, -24(%rbp)
	movl	-20(%rbp), %edx
	movl	-48(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -36(%rbp)
	movl	-20(%rbp), %eax
	subl	-36(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-36(%rbp), %eax
	addl	%eax, -44(%rbp)
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L22
	movq	-32(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rdi
	movq	%rax, %rsi
	call	enqueue
	jmp	.L21
.L22:
	movl	-44(%rbp), %edx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L21:
	movl	head(%rip), %edx
	movl	tail(%rip), %eax
	cmpl	%eax, %edx
	jne	.L24
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.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:
