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 N 100     
#define SUCCESS 1 // 成功
#define FAILURE 0 // 失敗
#define INFTY 1 << 21 // 到達不可能を表す大きな値

int queue[N]; // キューの本体
int queue_head = 0; // データ先頭
int queue_num; // データ個数

int node_num, M[N + 1][N + 1];
int d[N]; // 距離で訪問状態(color)を管理する

int enqueue(int enq_data) // キューにデータを追加する
{
  if (queue_head + queue_num < N) {
    queue[queue_head + queue_num] = enq_data;
    queue_num++;
    return SUCCESS;
  } else {
    return FAILURE;
  }
}

int dequeue(int *deq_data) // キューからデータを取り出す
{
  if (queue_num > 0) {
    *deq_data = queue[queue_head];
    queue_num--;
    queue_head++;
    return SUCCESS;
  } else {
    return FAILURE;
  }
}

void bfs(int s) {
  enqueue(s); // 始点をキューに入れる
  for (int i = 1; i <= node_num; i++) d[i] = INFTY; // とりあえず全部INFTYにする
  d[s] = 0; // 始点から自分自身までの距離は0
  int u, p;
  while(queue_num > 0) { // キューが空でない間繰り返す
    u = queue[queue_head]; // キューの先頭からノードを取り出し，訪問
    dequeue(&p); // 同上
    for (int v = 1; v <= node_num; v++) {
        if (M[u][v] == 0) continue; // キュー先頭のノードとvが繋がってないならこのループは終了
        if (d[v] != INFTY) continue; // 既に距離を決めているならこのループは終了
        d[v] = d[u] + 1; // 次に訪問するノードまでの距離は，それまでの距離+1
        enqueue(v); // uに繋がっているノードは将来訪問しないといけない
    }
  }
  for (int i = 1; i <= node_num; i++) { // 表示部
    if (d[i] == INFTY) d[i] = -1;
    printf("%d %d\n", i, d[i]);
  }
}

// mainの流れはdfsと同じ(隣接行列の初期化→隣接行列にノード間の接続関係を登録→bfsを呼び出す)
int main(void)
{
  int u, v, k, i, j;
  
  scanf("%d", &node_num);
  for (i = 0; i <= node_num; i++) {
    for(j = 0; j <= node_num; j++) M[i][j] = 0;
  }

  for (i = 0; i < node_num; i++) {
    scanf("%d %d", &u, &k);
    for (j = 0; j < k; j++) {
      scanf("%d", &v);
      M[u][v] = 1;
    }
  }

  bfs(1);
  
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	queue
	.bss
	.align 32
	.type	queue, @object
	.size	queue, 400
queue:
	.zero	400
	.globl	queue_head
	.align 4
	.type	queue_head, @object
	.size	queue_head, 4
queue_head:
	.zero	4
	.globl	queue_num
	.align 4
	.type	queue_num, @object
	.size	queue_num, 4
queue_num:
	.zero	4
	.globl	node_num
	.align 4
	.type	node_num, @object
	.size	node_num, 4
node_num:
	.zero	4
	.globl	M
	.align 32
	.type	M, @object
	.size	M, 40804
M:
	.zero	40804
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400
d:
	.zero	400
	.text
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	queue_head(%rip), %edx
	movl	queue_num(%rip), %eax
	addl	%edx, %eax
	cmpl	$99, %eax
	jg	.L2
	movl	queue_head(%rip), %edx
	movl	queue_num(%rip), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	queue(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	queue_num(%rip), %eax
	addl	$1, %eax
	movl	%eax, queue_num(%rip)
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	enqueue, .-enqueue
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movl	queue_num(%rip), %eax
	testl	%eax, %eax
	jle	.L5
	movl	queue_head(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	queue(%rip), %rax
	movl	(%rdx,%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, (%rax)
	movl	queue_num(%rip), %eax
	subl	$1, %eax
	movl	%eax, queue_num(%rip)
	movl	queue_head(%rip), %eax
	addl	$1, %eax
	movl	%eax, queue_head(%rip)
	movl	$1, %eax
	jmp	.L6
.L5:
	movl	$0, %eax
.L6:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	dequeue, .-dequeue
	.section	.rodata
.LC0:
	.string	"%d %d\n"
	.text
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB2:
	.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)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	-36(%rbp), %eax
	movl	%eax, %edi
	call	enqueue
	movl	$1, -24(%rbp)
	jmp	.L8
.L9:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	$2097152, (%rdx,%rax)
	addl	$1, -24(%rbp)
.L8:
	movl	node_num(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L9
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L10
.L16:
	movl	queue_head(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	queue(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	leaq	-28(%rbp), %rax
	movq	%rax, %rdi
	call	dequeue
	movl	$1, -20(%rbp)
	jmp	.L11
.L15:
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	M(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L21
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$2097152, %eax
	jne	.L22
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	enqueue
	jmp	.L13
.L21:
	nop
	jmp	.L13
.L22:
	nop
.L13:
	addl	$1, -20(%rbp)
.L11:
	movl	node_num(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L15
.L10:
	movl	queue_num(%rip), %eax
	testl	%eax, %eax
	jg	.L16
	movl	$1, -16(%rbp)
	jmp	.L17
.L19:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$2097152, %eax
	jne	.L18
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	$-1, (%rdx,%rax)
.L18:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -16(%rbp)
.L17:
	movl	node_num(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L19
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	bfs, .-bfs
	.section	.rodata
.LC1:
	.string	"%d"
.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	node_num(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L24
.L27:
	movl	$0, -12(%rbp)
	jmp	.L25
.L26:
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	M(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L25:
	movl	node_num(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L26
	addl	$1, -16(%rbp)
.L24:
	movl	node_num(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L27
	movl	$0, -16(%rbp)
	jmp	.L28
.L31:
	leaq	-20(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L29
.L30:
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	movl	-24(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	M(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L29:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L30
	addl	$1, -16(%rbp)
.L28:
	movl	node_num(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L31
	movl	$1, %edi
	call	bfs
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	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	enqueue
	.type	enqueue, @function
enqueue:
.LFB23:
	.cfi_startproc
	endbr64
	movl	queue_num(%rip), %eax
	movl	queue_head(%rip), %edx
	xorl	%r8d, %r8d
	addl	%eax, %edx
	cmpl	$99, %edx
	jg	.L1
	movslq	%edx, %rdx
	leaq	queue(%rip), %rcx
	addl	$1, %eax
	movl	$1, %r8d
	movl	%edi, (%rcx,%rdx,4)
	movl	%eax, queue_num(%rip)
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	enqueue, .-enqueue
	.p2align 4
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB24:
	.cfi_startproc
	endbr64
	movl	queue_num(%rip), %edx
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L5
	movslq	queue_head(%rip), %rdx
	leaq	queue(%rip), %rax
	movl	(%rax,%rdx,4), %eax
	movl	%eax, (%rdi)
	movl	$1, %eax
	subl	$1, queue_num(%rip)
	addl	$1, queue_head(%rip)
.L5:
	ret
	.cfi_endproc
.LFE24:
	.size	dequeue, .-dequeue
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d %d\n"
	.text
	.p2align 4
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movslq	%edi, %rcx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	queue_head(%rip), %edi
	movl	queue_num(%rip), %esi
	leal	(%rdi,%rsi), %eax
	cmpl	$99, %eax
	jg	.L9
	cltq
	leaq	queue(%rip), %rdx
	addl	$1, %esi
	movl	%ecx, (%rdx,%rax,4)
	movl	%esi, queue_num(%rip)
.L9:
	movl	node_num(%rip), %r11d
	testl	%r11d, %r11d
	jle	.L10
	leal	-1(%r11), %eax
	cmpl	$2, %eax
	jbe	.L24
	movl	%r11d, %edx
	leaq	4+d(%rip), %rax
	movdqa	.LC0(%rip), %xmm0
	shrl	$2, %edx
	leaq	16(%rax), %r8
	subl	$1, %edx
	salq	$4, %rdx
	addq	%r8, %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L12
	movl	%r11d, %edx
	leaq	d(%rip), %rbx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%r11d, %edx
	je	.L13
.L11:
	movslq	%eax, %rdx
	leaq	d(%rip), %rbx
	movl	$2097152, (%rbx,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%r11d, %edx
	jg	.L13
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	$2097152, (%rbx,%rdx,4)
	cmpl	%eax, %r11d
	jl	.L13
	cltq
	movl	$2097152, (%rbx,%rax,4)
.L13:
	movl	$0, (%rbx,%rcx,4)
	testl	%esi, %esi
	jle	.L14
.L23:
	addl	$1, %edi
	leaq	-4+queue(%rip), %r12
	leaq	M(%rip), %r13
	movslq	%edi, %r9
	leaq	4(%r12), %rbp
	leal	1(%r11), %edi
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	(%r12,%r9,4), %r8
	subl	$1, %esi
	movl	%r9d, %r10d
	testl	%r11d, %r11d
	jle	.L15
	imulq	$404, %r8, %rcx
	movl	$1, %eax
	addq	%r13, %rcx
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%rcx,%rax,4), %edx
	testl	%edx, %edx
	je	.L16
	cmpl	$2097152, (%rbx,%rax,4)
	jne	.L16
	movl	(%rbx,%r8,4), %edx
	addl	$1, %edx
	movl	%edx, (%rbx,%rax,4)
	leal	(%rsi,%r10), %edx
	cmpl	$99, %edx
	jg	.L16
	movslq	%edx, %rdx
	addl	$1, %esi
	movl	%eax, 0(%rbp,%rdx,4)
	.p2align 4,,10
	.p2align 3
.L16:
	addq	$1, %rax
	cmpq	%rdi, %rax
	jne	.L17
.L15:
	addq	$1, %r9
	testl	%esi, %esi
	jne	.L18
	movl	%r10d, queue_head(%rip)
	movl	$0, queue_num(%rip)
	testl	%r11d, %r11d
	jle	.L8
.L14:
	movl	$1, %ebp
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L22:
	movl	(%rbx,%rbp,4), %ecx
	movl	%ebp, %edx
	cmpl	$2097152, %ecx
	jne	.L19
	movl	$-1, (%rbx,%rbp,4)
	movl	$-1, %ecx
.L19:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$1, %edi
	addq	$1, %rbp
	call	__printf_chk@PLT
	cmpl	%ebp, node_num(%rip)
	jge	.L22
.L8:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	leaq	d(%rip), %rbx
	movl	$0, (%rbx,%rcx,4)
	testl	%esi, %esi
	jg	.L23
	jmp	.L8
.L24:
	movl	$1, %eax
	jmp	.L11
	.cfi_endproc
.LFE25:
	.size	bfs, .-bfs
	.section	.rodata.str1.1
.LC2:
	.string	"%d"
.LC3:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	node_num(%rip), %rsi
	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	.LC2(%rip), %rbx
	movq	%rbx, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	node_num(%rip), %r14d
	testl	%r14d, %r14d
	js	.L31
	movslq	%r14d, %rax
	leaq	M(%rip), %rbp
	imulq	$404, %rax, %r12
	leaq	404(%rbp), %rdx
	movq	%rbp, %rcx
	leaq	4(,%rax,4), %r13
	addq	%rdx, %r12
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rcx, %rdi
	movq	%r13, %rdx
	xorl	%esi, %esi
	call	memset@PLT
	movq	%rax, %rcx
	addq	$404, %rcx
	cmpq	%rcx, %r12
	jne	.L32
	testl	%r14d, %r14d
	jle	.L31
	leaq	28(%rsp), %rax
	xorl	%r13d, %r13d
	leaq	36(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L35:
	movq	8(%rsp), %rsi
	movq	%r15, %rdx
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	testl	%eax, %eax
	jle	.L33
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L34:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	movslq	32(%rsp), %rsi
	leaq	(%rax,%rax,4), %rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rax,%rcx,4), %rax
	addq	%rsi, %rax
	movl	$1, 0(%rbp,%rax,4)
	cmpl	%r14d, 36(%rsp)
	jg	.L34
.L33:
	addl	$1, %r13d
	cmpl	%r13d, node_num(%rip)
	jg	.L35
.L31:
	movl	$1, %edi
	call	bfs
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$56, %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
.L41:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE26:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 400
d:
	.zero	400
	.globl	M
	.align 32
	.type	M, @object
	.size	M, 40804
M:
	.zero	40804
	.globl	node_num
	.align 4
	.type	node_num, @object
	.size	node_num, 4
node_num:
	.zero	4
	.globl	queue_num
	.align 4
	.type	queue_num, @object
	.size	queue_num, 4
queue_num:
	.zero	4
	.globl	queue_head
	.align 4
	.type	queue_head, @object
	.size	queue_head, 4
queue_head:
	.zero	4
	.globl	queue
	.align 32
	.type	queue, @object
	.size	queue, 400
queue:
	.zero	400
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	2097152
	.long	2097152
	.long	2097152
	.long	2097152
	.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	enqueue
	.type	enqueue, @function
enqueue:
.LFB23:
	.cfi_startproc
	endbr64
	movl	queue_num(%rip), %eax
	movl	queue_head(%rip), %edx
	xorl	%r8d, %r8d
	addl	%eax, %edx
	cmpl	$99, %edx
	jg	.L1
	movslq	%edx, %rdx
	leaq	queue(%rip), %rcx
	addl	$1, %eax
	movl	$1, %r8d
	movl	%edi, (%rcx,%rdx,4)
	movl	%eax, queue_num(%rip)
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	enqueue, .-enqueue
	.p2align 4
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB24:
	.cfi_startproc
	endbr64
	movl	queue_num(%rip), %edx
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L5
	movslq	queue_head(%rip), %rdx
	leaq	queue(%rip), %rax
	movl	(%rax,%rdx,4), %eax
	movl	%eax, (%rdi)
	movl	$1, %eax
	subl	$1, queue_num(%rip)
	addl	$1, queue_head(%rip)
.L5:
	ret
	.cfi_endproc
.LFE24:
	.size	dequeue, .-dequeue
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d %d\n"
	.text
	.p2align 4
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movslq	%edi, %rcx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	queue_head(%rip), %edi
	movl	queue_num(%rip), %esi
	leal	(%rdi,%rsi), %eax
	cmpl	$99, %eax
	jg	.L9
	cltq
	leaq	queue(%rip), %rdx
	addl	$1, %esi
	movl	%ecx, (%rdx,%rax,4)
	movl	%esi, queue_num(%rip)
.L9:
	movl	node_num(%rip), %r11d
	testl	%r11d, %r11d
	jle	.L10
	leal	-1(%r11), %eax
	cmpl	$2, %eax
	jbe	.L24
	movl	%r11d, %edx
	leaq	4+d(%rip), %rax
	movdqa	.LC0(%rip), %xmm0
	shrl	$2, %edx
	leaq	16(%rax), %r8
	subl	$1, %edx
	salq	$4, %rdx
	addq	%r8, %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L12
	movl	%r11d, %edx
	leaq	d(%rip), %rbx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%r11d, %edx
	je	.L13
.L11:
	movslq	%eax, %rdx
	leaq	d(%rip), %rbx
	movl	$2097152, (%rbx,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%r11d, %edx
	jg	.L13
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	$2097152, (%rbx,%rdx,4)
	cmpl	%eax, %r11d
	jl	.L13
	cltq
	movl	$2097152, (%rbx,%rax,4)
.L13:
	movl	$0, (%rbx,%rcx,4)
	testl	%esi, %esi
	jle	.L14
.L23:
	addl	$1, %edi
	leaq	-4+queue(%rip), %r12
	leaq	M(%rip), %r13
	movslq	%edi, %r9
	leaq	4(%r12), %rbp
	leal	1(%r11), %edi
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	(%r12,%r9,4), %r8
	subl	$1, %esi
	movl	%r9d, %r10d
	testl	%r11d, %r11d
	jle	.L15
	imulq	$404, %r8, %rcx
	movl	$1, %eax
	addq	%r13, %rcx
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%rcx,%rax,4), %edx
	testl	%edx, %edx
	je	.L16
	cmpl	$2097152, (%rbx,%rax,4)
	jne	.L16
	movl	(%rbx,%r8,4), %edx
	addl	$1, %edx
	movl	%edx, (%rbx,%rax,4)
	leal	(%rsi,%r10), %edx
	cmpl	$99, %edx
	jg	.L16
	movslq	%edx, %rdx
	addl	$1, %esi
	movl	%eax, 0(%rbp,%rdx,4)
	.p2align 4,,10
	.p2align 3
.L16:
	addq	$1, %rax
	cmpq	%rdi, %rax
	jne	.L17
.L15:
	addq	$1, %r9
	testl	%esi, %esi
	jne	.L18
	movl	%r10d, queue_head(%rip)
	movl	$0, queue_num(%rip)
	testl	%r11d, %r11d
	jle	.L8
.L14:
	movl	$1, %ebp
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L22:
	movl	(%rbx,%rbp,4), %ecx
	movl	%ebp, %edx
	cmpl	$2097152, %ecx
	jne	.L19
	movl	$-1, (%rbx,%rbp,4)
	movl	$-1, %ecx
.L19:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$1, %edi
	addq	$1, %rbp
	call	__printf_chk@PLT
	cmpl	%ebp, node_num(%rip)
	jge	.L22
.L8:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	leaq	d(%rip), %rbx
	movl	$0, (%rbx,%rcx,4)
	testl	%esi, %esi
	jg	.L23
	jmp	.L8
.L24:
	movl	$1, %eax
	jmp	.L11
	.cfi_endproc
.LFE25:
	.size	bfs, .-bfs
	.section	.rodata.str1.1
.LC2:
	.string	"%d"
.LC3:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	node_num(%rip), %rsi
	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	.LC2(%rip), %rbx
	movq	%rbx, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	node_num(%rip), %r14d
	testl	%r14d, %r14d
	js	.L31
	movslq	%r14d, %rax
	leaq	M(%rip), %rbp
	imulq	$404, %rax, %r12
	leaq	404(%rbp), %rdx
	movq	%rbp, %rcx
	leaq	4(,%rax,4), %r13
	addq	%rdx, %r12
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rcx, %rdi
	movq	%r13, %rdx
	xorl	%esi, %esi
	call	memset@PLT
	movq	%rax, %rcx
	addq	$404, %rcx
	cmpq	%rcx, %r12
	jne	.L32
	testl	%r14d, %r14d
	jle	.L31
	leaq	28(%rsp), %rax
	xorl	%r13d, %r13d
	leaq	36(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L35:
	movq	8(%rsp), %rsi
	movq	%r15, %rdx
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	testl	%eax, %eax
	jle	.L33
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L34:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	movslq	32(%rsp), %rsi
	leaq	(%rax,%rax,4), %rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rax,%rcx,4), %rax
	addq	%rsi, %rax
	movl	$1, 0(%rbp,%rax,4)
	cmpl	%r14d, 36(%rsp)
	jg	.L34
.L33:
	addl	$1, %r13d
	cmpl	%r13d, node_num(%rip)
	jg	.L35
.L31:
	movl	$1, %edi
	call	bfs
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$56, %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
.L41:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE26:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 400
d:
	.zero	400
	.globl	M
	.align 32
	.type	M, @object
	.size	M, 40804
M:
	.zero	40804
	.globl	node_num
	.align 4
	.type	node_num, @object
	.size	node_num, 4
node_num:
	.zero	4
	.globl	queue_num
	.align 4
	.type	queue_num, @object
	.size	queue_num, 4
queue_num:
	.zero	4
	.globl	queue_head
	.align 4
	.type	queue_head, @object
	.size	queue_head, 4
queue_head:
	.zero	4
	.globl	queue
	.align 32
	.type	queue, @object
	.size	queue, 400
queue:
	.zero	400
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	2097152
	.long	2097152
	.long	2097152
	.long	2097152
	.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 N 100     
#define SUCCESS 1 // 成功
#define FAILURE 0 // 失敗
#define INFTY 1 << 21 // 到達不可能を表す大きな値

int queue[N]; // キューの本体
int queue_head = 0; // データ先頭
int queue_num; // データ個数

int node_num, M[N + 1][N + 1];
int d[N]; // 距離で訪問状態(color)を管理する

int enqueue(int enq_data) // キューにデータを追加する
{
  if (queue_head + queue_num < N) {
    queue[queue_head + queue_num] = enq_data;
    queue_num++;
    return SUCCESS;
  } else {
    return FAILURE;
  }
}

int dequeue(int *deq_data) // キューからデータを取り出す
{
  if (queue_num > 0) {
    *deq_data = queue[queue_head];
    queue_num--;
    queue_head++;
    return SUCCESS;
  } else {
    return FAILURE;
  }
}

void bfs(int s) {
  enqueue(s); // 始点をキューに入れる
  for (int i = 1; i <= node_num; i++) d[i] = INFTY; // とりあえず全部INFTYにする
  d[s] = 0; // 始点から自分自身までの距離は0
  int u, p;
  while(queue_num > 0) { // キューが空でない間繰り返す
    u = queue[queue_head]; // キューの先頭からノードを取り出し，訪問
    dequeue(&p); // 同上
    for (int v = 1; v <= node_num; v++) {
        if (M[u][v] == 0) continue; // キュー先頭のノードとvが繋がってないならこのループは終了
        if (d[v] != INFTY) continue; // 既に距離を決めているならこのループは終了
        d[v] = d[u] + 1; // 次に訪問するノードまでの距離は，それまでの距離+1
        enqueue(v); // uに繋がっているノードは将来訪問しないといけない
    }
  }
  for (int i = 1; i <= node_num; i++) { // 表示部
    if (d[i] == INFTY) d[i] = -1;
    printf("%d %d\n", i, d[i]);
  }
}

// mainの流れはdfsと同じ(隣接行列の初期化→隣接行列にノード間の接続関係を登録→bfsを呼び出す)
int main(void)
{
  int u, v, k, i, j;
  
  scanf("%d", &node_num);
  for (i = 0; i <= node_num; i++) {
    for(j = 0; j <= node_num; j++) M[i][j] = 0;
  }

  for (i = 0; i < node_num; i++) {
    scanf("%d %d", &u, &k);
    for (j = 0; j < k; j++) {
      scanf("%d", &v);
      M[u][v] = 1;
    }
  }

  bfs(1);
  
  return 0;
}

4
1 2 1 4
2 1 4
3 0
4 1 3
 4
1 2 1 4
2 1 4
3 0
4 1 4
 4
1 2 2 4
2 1 4
3 0
4 1 1
 4
1 2 2 4
2 1 1
3 0
4 1 3
 4
1 2 1 1
2 1 4
3 0
4 1 4
 4
1 2 2 1
2 1 1
3 0
4 1 3
 4
1 2 1 4
3 1 4
3 0
4 1 2
 4
1 2 3 4
4 1 4
3 -1
3 1 0
 4
1 2 1 3
0 1 1
4 0
4 1 1
 4
1 2 2 1
2 1 4
3 0
3 1 0

1 0
2 -1
3 2
4 1
 1 0
2 -1
3 -1
4 1
 1 0
2 1
3 -1
4 1
 1 0
2 1
3 2
4 1
 1 0
2 -1
3 -1
4 -1
 1 0
2 1
3 -1
4 -1
 1 0
2 2
3 -1
4 1
 1 0
2 -1
3 1
4 1
 1 0
2 -1
3 1
4 -1
 1 0
2 1
3 -1
4 2

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 N 100     
#define SUCCESS 1 // 成功
#define FAILURE 0 // 失敗
#define INFTY 1 << 21 // 到達不可能を表す大きな値

int queue[N]; // キューの本体
int queue_head = 0; // データ先頭
int queue_num; // データ個数

int node_num, M[N + 1][N + 1];
int d[N]; // 距離で訪問状態(color)を管理する

int enqueue(int enq_data) // キューにデータを追加する
{
  if (queue_head + queue_num < N) {
    queue[queue_head + queue_num] = enq_data;
    queue_num++;
    return SUCCESS;
  } else {
    return FAILURE;
  }
}

int dequeue(int *deq_data) // キューからデータを取り出す
{
  if (queue_num > 0) {
    *deq_data = queue[queue_head];
    queue_num--;
    queue_head++;
    return SUCCESS;
  } else {
    return FAILURE;
  }
}

void bfs(int s) {
  enqueue(s); // 始点をキューに入れる
  for (int i = 1; i <= node_num; i++) d[i] = INFTY; // とりあえず全部INFTYにする
  d[s] = 0; // 始点から自分自身までの距離は0
  int u, p;
  while(queue_num > 0) { // キューが空でない間繰り返す
    u = queue[queue_head]; // キューの先頭からノードを取り出し，訪問
    dequeue(&p); // 同上
    for (int v = 1; v <= node_num; v++) {
        if (M[u][v] == 0) continue; // キュー先頭のノードとvが繋がってないならこのループは終了
        if (d[v] != INFTY) continue; // 既に距離を決めているならこのループは終了
        d[v] = d[u] + 1; // 次に訪問するノードまでの距離は，それまでの距離+1
        enqueue(v); // uに繋がっているノードは将来訪問しないといけない
    }
  }
  for (int i = 1; i <= node_num; i++) { // 表示部
    if (d[i] == INFTY) d[i] = -1;
    printf("%d %d\n", i, d[i]);
  }
}

// mainの流れはdfsと同じ(隣接行列の初期化→隣接行列にノード間の接続関係を登録→bfsを呼び出す)
int main(void)
{
  int u, v, k, i, j;
  
  scanf("%d", &node_num);
  for (i = 0; i <= node_num; i++) {
    for(j = 0; j <= node_num; j++) M[i][j] = 0;
  }

  for (i = 0; i < node_num; i++) {
    scanf("%d %d", &u, &k);
    for (j = 0; j < k; j++) {
      scanf("%d", &v);
      M[u][v] = 1;
    }
  }

  bfs(1);
  
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	queue
	.bss
	.align 32
	.type	queue, @object
	.size	queue, 400
queue:
	.zero	400
	.globl	queue_head
	.align 4
	.type	queue_head, @object
	.size	queue_head, 4
queue_head:
	.zero	4
	.globl	queue_num
	.align 4
	.type	queue_num, @object
	.size	queue_num, 4
queue_num:
	.zero	4
	.globl	node_num
	.align 4
	.type	node_num, @object
	.size	node_num, 4
node_num:
	.zero	4
	.globl	M
	.align 32
	.type	M, @object
	.size	M, 40804
M:
	.zero	40804
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400
d:
	.zero	400
	.text
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	queue_head(%rip), %edx
	movl	queue_num(%rip), %eax
	addl	%edx, %eax
	cmpl	$99, %eax
	jg	.L2
	movl	queue_head(%rip), %edx
	movl	queue_num(%rip), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	queue(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	queue_num(%rip), %eax
	addl	$1, %eax
	movl	%eax, queue_num(%rip)
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	enqueue, .-enqueue
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movl	queue_num(%rip), %eax
	testl	%eax, %eax
	jle	.L5
	movl	queue_head(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	queue(%rip), %rax
	movl	(%rdx,%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, (%rax)
	movl	queue_num(%rip), %eax
	subl	$1, %eax
	movl	%eax, queue_num(%rip)
	movl	queue_head(%rip), %eax
	addl	$1, %eax
	movl	%eax, queue_head(%rip)
	movl	$1, %eax
	jmp	.L6
.L5:
	movl	$0, %eax
.L6:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	dequeue, .-dequeue
	.section	.rodata
.LC0:
	.string	"%d %d\n"
	.text
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB2:
	.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)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	-36(%rbp), %eax
	movl	%eax, %edi
	call	enqueue
	movl	$1, -24(%rbp)
	jmp	.L8
.L9:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	$2097152, (%rdx,%rax)
	addl	$1, -24(%rbp)
.L8:
	movl	node_num(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L9
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L10
.L16:
	movl	queue_head(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	queue(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	leaq	-28(%rbp), %rax
	movq	%rax, %rdi
	call	dequeue
	movl	$1, -20(%rbp)
	jmp	.L11
.L15:
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	M(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L21
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$2097152, %eax
	jne	.L22
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	enqueue
	jmp	.L13
.L21:
	nop
	jmp	.L13
.L22:
	nop
.L13:
	addl	$1, -20(%rbp)
.L11:
	movl	node_num(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L15
.L10:
	movl	queue_num(%rip), %eax
	testl	%eax, %eax
	jg	.L16
	movl	$1, -16(%rbp)
	jmp	.L17
.L19:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$2097152, %eax
	jne	.L18
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	$-1, (%rdx,%rax)
.L18:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -16(%rbp)
.L17:
	movl	node_num(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L19
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	bfs, .-bfs
	.section	.rodata
.LC1:
	.string	"%d"
.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	node_num(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L24
.L27:
	movl	$0, -12(%rbp)
	jmp	.L25
.L26:
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	M(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L25:
	movl	node_num(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L26
	addl	$1, -16(%rbp)
.L24:
	movl	node_num(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L27
	movl	$0, -16(%rbp)
	jmp	.L28
.L31:
	leaq	-20(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L29
.L30:
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	movl	-24(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	M(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L29:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L30
	addl	$1, -16(%rbp)
.L28:
	movl	node_num(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L31
	movl	$1, %edi
	call	bfs
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	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	queue
	.bss
	.align 32
	.type	queue, @object
	.size	queue, 400
queue:
	.zero	400
	.globl	queue_head
	.align 4
	.type	queue_head, @object
	.size	queue_head, 4
queue_head:
	.zero	4
	.globl	queue_num
	.align 4
	.type	queue_num, @object
	.size	queue_num, 4
queue_num:
	.zero	4
	.globl	node_num
	.align 4
	.type	node_num, @object
	.size	node_num, 4
node_num:
	.zero	4
	.globl	M
	.align 32
	.type	M, @object
	.size	M, 40804
M:
	.zero	40804
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400
d:
	.zero	400
	.text
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	queue_head(%rip), %edx
	movl	queue_num(%rip), %eax
	addl	%edx, %eax
	cmpl	$99, %eax
	jg	.L2
	movl	queue_head(%rip), %edx
	movl	queue_num(%rip), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	queue(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	queue_num(%rip), %eax
	addl	$1, %eax
	movl	%eax, queue_num(%rip)
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	enqueue, .-enqueue
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movl	queue_num(%rip), %eax
	testl	%eax, %eax
	jle	.L5
	movl	queue_head(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	queue(%rip), %rax
	movl	(%rdx,%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, (%rax)
	movl	queue_num(%rip), %eax
	subl	$1, %eax
	movl	%eax, queue_num(%rip)
	movl	queue_head(%rip), %eax
	addl	$1, %eax
	movl	%eax, queue_head(%rip)
	movl	$1, %eax
	jmp	.L6
.L5:
	movl	$0, %eax
.L6:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	dequeue, .-dequeue
	.section	.rodata
.LC0:
	.string	"%d %d\n"
	.text
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB2:
	.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)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	-36(%rbp), %eax
	movl	%eax, %edi
	call	enqueue
	movl	$1, -24(%rbp)
	jmp	.L8
.L9:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	$2097152, (%rdx,%rax)
	addl	$1, -24(%rbp)
.L8:
	movl	node_num(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L9
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L10
.L16:
	movl	queue_head(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	queue(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	leaq	-28(%rbp), %rax
	movq	%rax, %rdi
	call	dequeue
	movl	$1, -20(%rbp)
	jmp	.L11
.L15:
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	M(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L21
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$2097152, %eax
	jne	.L22
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	enqueue
	jmp	.L13
.L21:
	nop
	jmp	.L13
.L22:
	nop
.L13:
	addl	$1, -20(%rbp)
.L11:
	movl	node_num(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L15
.L10:
	movl	queue_num(%rip), %eax
	testl	%eax, %eax
	jg	.L16
	movl	$1, -16(%rbp)
	jmp	.L17
.L19:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$2097152, %eax
	jne	.L18
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	$-1, (%rdx,%rax)
.L18:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -16(%rbp)
.L17:
	movl	node_num(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L19
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	bfs, .-bfs
	.section	.rodata
.LC1:
	.string	"%d"
.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	node_num(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L24
.L27:
	movl	$0, -12(%rbp)
	jmp	.L25
.L26:
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	M(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L25:
	movl	node_num(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L26
	addl	$1, -16(%rbp)
.L24:
	movl	node_num(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L27
	movl	$0, -16(%rbp)
	jmp	.L28
.L31:
	leaq	-20(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L29
.L30:
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	movl	-24(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	M(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L29:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L30
	addl	$1, -16(%rbp)
.L28:
	movl	node_num(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L31
	movl	$1, %edi
	call	bfs
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	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:
