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>
#include<stdlib.h>
typedef struct Graph
{
  int key;
  int numOfAdj;
  int *adj;
  int status;//0:not discovered, 1:discovered, 2:finished
} graph;
void depthFirstSearch(void);
void visit(int);
int n;//num of vertice
graph *p;//array of vertice
int *d;//timestamp of first discovered time
int *f;//timestamp of finishing examining time
int timeOfSearch;//time passed during the depth first search
int main(void)
{
  int i,j;//counter
  int key,numOfAdj,adj;
  scanf("%d",&n);
  p=(graph*)malloc(sizeof(graph)*n);
  d=(int*)malloc(sizeof(int)*n);
  f=(int*)malloc(sizeof(int)*n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&key);
      scanf("%d",&numOfAdj);
      p[key-1].numOfAdj=numOfAdj;
      p[key-1].adj=(int*)malloc(sizeof(int)*numOfAdj);
      for(j=0;j<numOfAdj;j++)
	{
	  scanf("%d",&adj);
	  p[key-1].adj[j]=adj-1;
	}
      p[key-1].status=0;
      d[i]=0;
      f[i]=0;
    }
  depthFirstSearch();
  return 0;
}
void depthFirstSearch(void)
{
  int i;//counter
  timeOfSearch=0;
  for(;;)
    {
      for(i=0;i<n;i++)
	{
	  if(p[i].status==0) visit(i);
	}
      if(i==n) break;
    }
  for(i=0;i<n;i++)
    {
      printf("%d %d %d\n",i+1,d[i],f[i]);
    }
}
void visit(int key)
{
  int i;//counter
  p[key].status=1;
  timeOfSearch++;
  d[key]=timeOfSearch;
  for(i=0;i<p[key].numOfAdj;i++)
    {
      if(p[p[key].adj[i]].status==0) visit(p[key].adj[i]);
    }
  p[key].status=2;
  timeOfSearch++;
  f[key]=timeOfSearch;
}


```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	f
	.align 8
	.type	f, @object
	.size	f, 8
f:
	.zero	8
	.globl	timeOfSearch
	.align 4
	.type	timeOfSearch, @object
	.size	timeOfSearch, 4
timeOfSearch:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, p(%rip)
	movl	n(%rip), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, d(%rip)
	movl	n(%rip), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, f(%rip)
	movl	$0, -32(%rbp)
	jmp	.L2
.L5:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	p(%rip), %rcx
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	subq	$24, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-40(%rbp), %eax
	movl	%eax, 4(%rdx)
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	p(%rip), %rsi
	movl	-44(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	subq	$24, %rax
	leaq	(%rsi,%rax), %rbx
	movq	%rdx, %rdi
	call	malloc@PLT
	movq	%rax, 8(%rbx)
	movl	$0, -28(%rbp)
	jmp	.L3
.L4:
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %ecx
	movq	p(%rip), %rsi
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	subq	$24, %rax
	addq	%rsi, %rax
	movq	8(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	leal	-1(%rcx), %edx
	movl	%edx, (%rax)
	addl	$1, -28(%rbp)
.L3:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L4
	movq	p(%rip), %rcx
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	subq	$24, %rax
	addq	%rcx, %rax
	movl	$0, 16(%rax)
	movq	d(%rip), %rdx
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movq	f(%rip), %rdx
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -32(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L5
	call	depthFirstSearch
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
.LC1:
	.string	"%d %d %d\n"
	.text
	.globl	depthFirstSearch
	.type	depthFirstSearch, @function
depthFirstSearch:
.LFB7:
	.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
	movl	$0, timeOfSearch(%rip)
.L14:
	movl	$0, -4(%rbp)
	jmp	.L9
.L11:
	movq	p(%rip), %rcx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	16(%rax), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	visit
.L10:
	addl	$1, -4(%rbp)
.L9:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	je	.L18
	jmp	.L14
.L18:
	nop
	movl	$0, -4(%rbp)
	jmp	.L15
.L16:
	movq	f(%rip), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	d(%rip), %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	movl	-4(%rbp), %ecx
	leal	1(%rcx), %esi
	movl	%edx, %ecx
	movl	%eax, %edx
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4(%rbp)
.L15:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L16
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	depthFirstSearch, .-depthFirstSearch
	.globl	visit
	.type	visit, @function
visit:
.LFB8:
	.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
	movl	%edi, -20(%rbp)
	movq	p(%rip), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	$1, 16(%rax)
	movl	timeOfSearch(%rip), %eax
	addl	$1, %eax
	movl	%eax, timeOfSearch(%rip)
	movq	d(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	timeOfSearch(%rip), %eax
	movl	%eax, (%rdx)
	movl	$0, -4(%rbp)
	jmp	.L20
.L22:
	movq	p(%rip), %rcx
	movq	p(%rip), %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rsi, %rax
	movq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	16(%rax), %eax
	testl	%eax, %eax
	jne	.L21
	movq	p(%rip), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %edi
	call	visit
.L21:
	addl	$1, -4(%rbp)
.L20:
	movq	p(%rip), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L22
	movq	p(%rip), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	$2, 16(%rax)
	movl	timeOfSearch(%rip), %eax
	addl	$1, %eax
	movl	%eax, timeOfSearch(%rip)
	movq	f(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	timeOfSearch(%rip), %eax
	movl	%eax, (%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	visit, .-visit
	.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	visit
	.type	visit, @function
visit:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	d(%rip), %rdx
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	p(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movslq	%edi, %rbp
	leaq	0(%rbp,%rbp,2), %rax
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	0(%r13,%rax,8), %r12
	movl	timeOfSearch(%rip), %eax
	movl	$1, 16(%r12)
	addl	$1, %eax
	movl	%eax, timeOfSearch(%rip)
	movl	%eax, (%rdx,%rbp,4)
	movl	4(%r12), %edx
	testl	%edx, %edx
	jle	.L5
	movq	8(%r12), %r14
	xorl	%ebx, %ebx
.L6:
	movslq	(%r14,%rbx,4), %rax
	movq	%rax, %rdi
	leaq	(%rax,%rax,2), %rax
	movl	16(%r13,%rax,8), %eax
	testl	%eax, %eax
	je	.L10
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L6
.L5:
	movl	timeOfSearch(%rip), %eax
	movq	f(%rip), %rdx
	movl	$2, 16(%r12)
	addl	$1, %eax
	movl	%eax, timeOfSearch(%rip)
	movl	%eax, (%rdx,%rbp,4)
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	call	visit
	movl	4(%r12), %edx
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L6
	jmp	.L5
	.cfi_endproc
.LFE41:
	.size	visit, .-visit
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d %d\n"
	.text
	.p2align 4
	.globl	depthFirstSearch
	.type	depthFirstSearch, @function
depthFirstSearch:
.LFB40:
	.cfi_startproc
	endbr64
	movl	$0, timeOfSearch(%rip)
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L34
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	.p2align 4,,10
	.p2align 3
.L29:
	movq	p(%rip), %rdx
	xorl	%ecx, %ecx
	leaq	16(%rdx), %rsi
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rsi), %edx
	testl	%edx, %edx
	je	.L35
	addl	$1, %ecx
	addq	$24, %rsi
	cmpl	%eax, %ecx
	jl	.L16
.L15:
	cmpl	%ecx, %eax
	je	.L36
	testl	%eax, %eax
	jg	.L29
	je	.L11
.L18:
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L36:
	testl	%eax, %eax
	je	.L11
	xorl	%ebp, %ebp
	xorl	%ebx, %ebx
	leaq	.LC0(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L19:
	movq	d(%rip), %rax
	addl	$1, %ebx
	movq	%r12, %rsi
	movl	$1, %edi
	movl	%ebx, %edx
	movl	(%rax,%rbp), %ecx
	movq	f(%rip), %rax
	movl	(%rax,%rbp), %r8d
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__printf_chk@PLT
	cmpl	n(%rip), %ebx
	jl	.L19
.L11:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L35:
	.cfi_restore_state
	movl	%ecx, %edi
	addl	$1, %ecx
	addq	$24, %rsi
	call	visit
	movl	n(%rip), %eax
	cmpl	%ecx, %eax
	jg	.L16
	jmp	.L15
.L34:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	je	.L31
.L32:
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L31:
	ret
	.cfi_endproc
.LFE40:
	.size	depthFirstSearch, .-depthFirstSearch
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %r15
	call	__isoc99_scanf@PLT
	movslq	n(%rip), %r12
	leaq	(%r12,%r12,2), %rdi
	movl	%r12d, 12(%rsp)
	salq	$2, %r12
	salq	$3, %rdi
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, p(%rip)
	call	malloc@PLT
	movq	%r12, %rdi
	leaq	36(%rsp), %r12
	movq	%rax, d(%rip)
	call	malloc@PLT
	movl	12(%rsp), %edx
	movq	%rax, f(%rip)
	leaq	32(%rsp), %rax
	movq	%rax, (%rsp)
	testl	%edx, %edx
	jle	.L41
	.p2align 4,,10
	.p2align 3
.L38:
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	movslq	32(%rsp), %rdi
	leaq	(%rax,%rax,2), %rdx
	movq	p(%rip), %rax
	movq	%rdi, %r14
	leaq	-24(%rax,%rdx,8), %rbx
	movl	%edi, 4(%rbx)
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, 8(%rbx)
	testl	%r14d, %r14d
	jle	.L39
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L40:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	movq	p(%rip), %rdx
	leaq	(%rax,%rax,2), %rax
	movq	-16(%rdx,%rax,8), %rcx
	movl	36(%rsp), %eax
	subl	$1, %eax
	movl	%eax, (%rcx,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, 32(%rsp)
	jg	.L40
	movslq	28(%rsp), %rax
	leaq	(%rax,%rax,2), %rax
	leaq	-24(%rdx,%rax,8), %rbx
.L39:
	movq	d(%rip), %rax
	movl	$0, 16(%rbx)
	movl	$0, (%rax,%r13,4)
	movq	f(%rip), %rax
	movl	$0, (%rax,%r13,4)
	addq	$1, %r13
	cmpl	%r13d, n(%rip)
	jg	.L38
.L41:
	call	depthFirstSearch
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L50
	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
.L50:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	timeOfSearch
	.bss
	.align 4
	.type	timeOfSearch, @object
	.size	timeOfSearch, 4
timeOfSearch:
	.zero	4
	.globl	f
	.align 8
	.type	f, @object
	.size	f, 8
f:
	.zero	8
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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	visit
	.type	visit, @function
visit:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	d(%rip), %rdx
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	p(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movslq	%edi, %rbp
	leaq	0(%rbp,%rbp,2), %rax
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	0(%r13,%rax,8), %r12
	movl	timeOfSearch(%rip), %eax
	movl	$1, 16(%r12)
	addl	$1, %eax
	movl	%eax, timeOfSearch(%rip)
	movl	%eax, (%rdx,%rbp,4)
	movl	4(%r12), %edx
	testl	%edx, %edx
	jle	.L5
	movq	8(%r12), %r14
	xorl	%ebx, %ebx
.L6:
	movslq	(%r14,%rbx,4), %rax
	movq	%rax, %rdi
	leaq	(%rax,%rax,2), %rax
	movl	16(%r13,%rax,8), %eax
	testl	%eax, %eax
	je	.L10
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L6
.L5:
	movl	timeOfSearch(%rip), %eax
	movq	f(%rip), %rdx
	movl	$2, 16(%r12)
	addl	$1, %eax
	movl	%eax, timeOfSearch(%rip)
	movl	%eax, (%rdx,%rbp,4)
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	call	visit
	movl	4(%r12), %edx
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L6
	jmp	.L5
	.cfi_endproc
.LFE41:
	.size	visit, .-visit
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d %d\n"
	.text
	.p2align 4
	.globl	depthFirstSearch
	.type	depthFirstSearch, @function
depthFirstSearch:
.LFB40:
	.cfi_startproc
	endbr64
	movl	$0, timeOfSearch(%rip)
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L34
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	.p2align 4,,10
	.p2align 3
.L29:
	movq	p(%rip), %rdx
	xorl	%ecx, %ecx
	leaq	16(%rdx), %rsi
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rsi), %edx
	testl	%edx, %edx
	je	.L35
	addl	$1, %ecx
	addq	$24, %rsi
	cmpl	%eax, %ecx
	jl	.L16
.L15:
	cmpl	%ecx, %eax
	je	.L36
	testl	%eax, %eax
	jg	.L29
	je	.L11
.L18:
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L36:
	testl	%eax, %eax
	je	.L11
	xorl	%ebp, %ebp
	xorl	%ebx, %ebx
	leaq	.LC0(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L19:
	movq	d(%rip), %rax
	addl	$1, %ebx
	movq	%r12, %rsi
	movl	$1, %edi
	movl	%ebx, %edx
	movl	(%rax,%rbp), %ecx
	movq	f(%rip), %rax
	movl	(%rax,%rbp), %r8d
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__printf_chk@PLT
	cmpl	n(%rip), %ebx
	jl	.L19
.L11:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L35:
	.cfi_restore_state
	movl	%ecx, %edi
	addl	$1, %ecx
	addq	$24, %rsi
	call	visit
	movl	n(%rip), %eax
	cmpl	%ecx, %eax
	jg	.L16
	jmp	.L15
.L34:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	je	.L31
.L32:
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L31:
	ret
	.cfi_endproc
.LFE40:
	.size	depthFirstSearch, .-depthFirstSearch
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %r15
	call	__isoc99_scanf@PLT
	movslq	n(%rip), %r12
	leaq	(%r12,%r12,2), %rdi
	movl	%r12d, 12(%rsp)
	salq	$2, %r12
	salq	$3, %rdi
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, p(%rip)
	call	malloc@PLT
	movq	%r12, %rdi
	leaq	36(%rsp), %r12
	movq	%rax, d(%rip)
	call	malloc@PLT
	movl	12(%rsp), %edx
	movq	%rax, f(%rip)
	leaq	32(%rsp), %rax
	movq	%rax, (%rsp)
	testl	%edx, %edx
	jle	.L41
	.p2align 4,,10
	.p2align 3
.L38:
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	movslq	32(%rsp), %rdi
	leaq	(%rax,%rax,2), %rdx
	movq	p(%rip), %rax
	movq	%rdi, %r14
	leaq	-24(%rax,%rdx,8), %rbx
	movl	%edi, 4(%rbx)
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, 8(%rbx)
	testl	%r14d, %r14d
	jle	.L39
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L40:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	movq	p(%rip), %rdx
	leaq	(%rax,%rax,2), %rax
	movq	-16(%rdx,%rax,8), %rcx
	movl	36(%rsp), %eax
	subl	$1, %eax
	movl	%eax, (%rcx,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, 32(%rsp)
	jg	.L40
	movslq	28(%rsp), %rax
	leaq	(%rax,%rax,2), %rax
	leaq	-24(%rdx,%rax,8), %rbx
.L39:
	movq	d(%rip), %rax
	movl	$0, 16(%rbx)
	movl	$0, (%rax,%r13,4)
	movq	f(%rip), %rax
	movl	$0, (%rax,%r13,4)
	addq	$1, %r13
	cmpl	%r13d, n(%rip)
	jg	.L38
.L41:
	call	depthFirstSearch
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L50
	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
.L50:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	timeOfSearch
	.bss
	.align 4
	.type	timeOfSearch, @object
	.size	timeOfSearch, 4
timeOfSearch:
	.zero	4
	.globl	f
	.align 8
	.type	f, @object
	.size	f, 8
f:
	.zero	8
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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>
#include<stdlib.h>
typedef struct Graph
{
  int key;
  int numOfAdj;
  int *adj;
  int status;//0:not discovered, 1:discovered, 2:finished
} graph;
void depthFirstSearch(void);
void visit(int);
int n;//num of vertice
graph *p;//array of vertice
int *d;//timestamp of first discovered time
int *f;//timestamp of finishing examining time
int timeOfSearch;//time passed during the depth first search
int main(void)
{
  int i,j;//counter
  int key,numOfAdj,adj;
  scanf("%d",&n);
  p=(graph*)malloc(sizeof(graph)*n);
  d=(int*)malloc(sizeof(int)*n);
  f=(int*)malloc(sizeof(int)*n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&key);
      scanf("%d",&numOfAdj);
      p[key-1].numOfAdj=numOfAdj;
      p[key-1].adj=(int*)malloc(sizeof(int)*numOfAdj);
      for(j=0;j<numOfAdj;j++)
	{
	  scanf("%d",&adj);
	  p[key-1].adj[j]=adj-1;
	}
      p[key-1].status=0;
      d[i]=0;
      f[i]=0;
    }
  depthFirstSearch();
  return 0;
}
void depthFirstSearch(void)
{
  int i;//counter
  timeOfSearch=0;
  for(;;)
    {
      for(i=0;i<n;i++)
	{
	  if(p[i].status==0) visit(i);
	}
      if(i==n) break;
    }
  for(i=0;i<n;i++)
    {
      printf("%d %d %d\n",i+1,d[i],f[i]);
    }
}
void visit(int key)
{
  int i;//counter
  p[key].status=1;
  timeOfSearch++;
  d[key]=timeOfSearch;
  for(i=0;i<p[key].numOfAdj;i++)
    {
      if(p[p[key].adj[i]].status==0) visit(p[key].adj[i]);
    }
  p[key].status=2;
  timeOfSearch++;
  f[key]=timeOfSearch;
}



6
1 2 2 3
2 2 3 4
3 1 6
4 1 6
5 1 6
6 0
 4
1 1 1
2 1 4
3 0
4 1 3
 4
1 1 1
2 1 4
3 0
4 1 2
 6
1 2 2 3
2 2 3 4
3 1 5
4 1 6
5 1 6
6 -1
 4
1 1 3
2 1 4
3 0
4 1 3
 4
1 1 3
2 1 1
3 0
4 1 3
 6
1 2 2 3
2 2 4 4
3 1 5
4 1 6
5 1 6
6 -1
 4
1 1 2
2 1 4
3 0
4 1 2
 4
1 1 2
2 1 2
3 0
4 1 3
 4
1 1 2
2 1 4
3 -1
4 1 3

1 1 10
2 2 9
3 3 6
4 7 8
5 11 12
6 4 5
 1 1 2
2 3 8
3 5 6
4 4 7
 1 1 2
2 3 6
3 7 8
4 4 5
 1 1 12
2 2 11
3 3 8
4 9 10
5 4 7
6 5 6
 1 1 4
2 5 8
3 2 3
4 6 7
 1 1 4
2 5 6
3 2 3
4 7 8
 1 1 12
2 2 7
3 8 11
4 3 6
5 9 10
6 4 5
 1 1 6
2 2 5
3 7 8
4 3 4
 1 1 4
2 2 3
3 5 6
4 7 8
 1 1 8
2 2 7
3 4 5
4 3 6

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

```c
#include<stdio.h>
#include<stdlib.h>
typedef struct Graph
{
  int key;
  int numOfAdj;
  int *adj;
  int status;//0:not discovered, 1:discovered, 2:finished
} graph;
void depthFirstSearch(void);
void visit(int);
int n;//num of vertice
graph *p;//array of vertice
int *d;//timestamp of first discovered time
int *f;//timestamp of finishing examining time
int timeOfSearch;//time passed during the depth first search
int main(void)
{
  int i,j;//counter
  int key,numOfAdj,adj;
  scanf("%d",&n);
  p=(graph*)malloc(sizeof(graph)*n);
  d=(int*)malloc(sizeof(int)*n);
  f=(int*)malloc(sizeof(int)*n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&key);
      scanf("%d",&numOfAdj);
      p[key-1].numOfAdj=numOfAdj;
      p[key-1].adj=(int*)malloc(sizeof(int)*numOfAdj);
      for(j=0;j<numOfAdj;j++)
	{
	  scanf("%d",&adj);
	  p[key-1].adj[j]=adj-1;
	}
      p[key-1].status=0;
      d[i]=0;
      f[i]=0;
    }
  depthFirstSearch();
  return 0;
}
void depthFirstSearch(void)
{
  int i;//counter
  timeOfSearch=0;
  for(;;)
    {
      for(i=0;i<n;i++)
	{
	  if(p[i].status==0) visit(i);
	}
      if(i==n) break;
    }
  for(i=0;i<n;i++)
    {
      printf("%d %d %d\n",i+1,d[i],f[i]);
    }
}
void visit(int key)
{
  int i;//counter
  p[key].status=1;
  timeOfSearch++;
  d[key]=timeOfSearch;
  for(i=0;i<p[key].numOfAdj;i++)
    {
      if(p[p[key].adj[i]].status==0) visit(p[key].adj[i]);
    }
  p[key].status=2;
  timeOfSearch++;
  f[key]=timeOfSearch;
}


```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	f
	.align 8
	.type	f, @object
	.size	f, 8
f:
	.zero	8
	.globl	timeOfSearch
	.align 4
	.type	timeOfSearch, @object
	.size	timeOfSearch, 4
timeOfSearch:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, p(%rip)
	movl	n(%rip), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, d(%rip)
	movl	n(%rip), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, f(%rip)
	movl	$0, -32(%rbp)
	jmp	.L2
.L5:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	p(%rip), %rcx
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	subq	$24, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-40(%rbp), %eax
	movl	%eax, 4(%rdx)
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	p(%rip), %rsi
	movl	-44(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	subq	$24, %rax
	leaq	(%rsi,%rax), %rbx
	movq	%rdx, %rdi
	call	malloc@PLT
	movq	%rax, 8(%rbx)
	movl	$0, -28(%rbp)
	jmp	.L3
.L4:
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %ecx
	movq	p(%rip), %rsi
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	subq	$24, %rax
	addq	%rsi, %rax
	movq	8(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	leal	-1(%rcx), %edx
	movl	%edx, (%rax)
	addl	$1, -28(%rbp)
.L3:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L4
	movq	p(%rip), %rcx
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	subq	$24, %rax
	addq	%rcx, %rax
	movl	$0, 16(%rax)
	movq	d(%rip), %rdx
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movq	f(%rip), %rdx
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -32(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L5
	call	depthFirstSearch
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
.LC1:
	.string	"%d %d %d\n"
	.text
	.globl	depthFirstSearch
	.type	depthFirstSearch, @function
depthFirstSearch:
.LFB7:
	.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
	movl	$0, timeOfSearch(%rip)
.L14:
	movl	$0, -4(%rbp)
	jmp	.L9
.L11:
	movq	p(%rip), %rcx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	16(%rax), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	visit
.L10:
	addl	$1, -4(%rbp)
.L9:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	je	.L18
	jmp	.L14
.L18:
	nop
	movl	$0, -4(%rbp)
	jmp	.L15
.L16:
	movq	f(%rip), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	d(%rip), %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	movl	-4(%rbp), %ecx
	leal	1(%rcx), %esi
	movl	%edx, %ecx
	movl	%eax, %edx
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4(%rbp)
.L15:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L16
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	depthFirstSearch, .-depthFirstSearch
	.globl	visit
	.type	visit, @function
visit:
.LFB8:
	.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
	movl	%edi, -20(%rbp)
	movq	p(%rip), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	$1, 16(%rax)
	movl	timeOfSearch(%rip), %eax
	addl	$1, %eax
	movl	%eax, timeOfSearch(%rip)
	movq	d(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	timeOfSearch(%rip), %eax
	movl	%eax, (%rdx)
	movl	$0, -4(%rbp)
	jmp	.L20
.L22:
	movq	p(%rip), %rcx
	movq	p(%rip), %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rsi, %rax
	movq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	16(%rax), %eax
	testl	%eax, %eax
	jne	.L21
	movq	p(%rip), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %edi
	call	visit
.L21:
	addl	$1, -4(%rbp)
.L20:
	movq	p(%rip), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L22
	movq	p(%rip), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	$2, 16(%rax)
	movl	timeOfSearch(%rip), %eax
	addl	$1, %eax
	movl	%eax, timeOfSearch(%rip)
	movq	f(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	timeOfSearch(%rip), %eax
	movl	%eax, (%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	visit, .-visit
	.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	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	f
	.align 8
	.type	f, @object
	.size	f, 8
f:
	.zero	8
	.globl	timeOfSearch
	.align 4
	.type	timeOfSearch, @object
	.size	timeOfSearch, 4
timeOfSearch:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, p(%rip)
	movl	n(%rip), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, d(%rip)
	movl	n(%rip), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, f(%rip)
	movl	$0, -32(%rbp)
	jmp	.L2
.L5:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	p(%rip), %rcx
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	subq	$24, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-40(%rbp), %eax
	movl	%eax, 4(%rdx)
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	p(%rip), %rsi
	movl	-44(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	subq	$24, %rax
	leaq	(%rsi,%rax), %rbx
	movq	%rdx, %rdi
	call	malloc@PLT
	movq	%rax, 8(%rbx)
	movl	$0, -28(%rbp)
	jmp	.L3
.L4:
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %ecx
	movq	p(%rip), %rsi
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	subq	$24, %rax
	addq	%rsi, %rax
	movq	8(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	leal	-1(%rcx), %edx
	movl	%edx, (%rax)
	addl	$1, -28(%rbp)
.L3:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L4
	movq	p(%rip), %rcx
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	subq	$24, %rax
	addq	%rcx, %rax
	movl	$0, 16(%rax)
	movq	d(%rip), %rdx
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movq	f(%rip), %rdx
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -32(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L5
	call	depthFirstSearch
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
.LC1:
	.string	"%d %d %d\n"
	.text
	.globl	depthFirstSearch
	.type	depthFirstSearch, @function
depthFirstSearch:
.LFB7:
	.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
	movl	$0, timeOfSearch(%rip)
.L14:
	movl	$0, -4(%rbp)
	jmp	.L9
.L11:
	movq	p(%rip), %rcx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	16(%rax), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	visit
.L10:
	addl	$1, -4(%rbp)
.L9:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	je	.L18
	jmp	.L14
.L18:
	nop
	movl	$0, -4(%rbp)
	jmp	.L15
.L16:
	movq	f(%rip), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	d(%rip), %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	movl	-4(%rbp), %ecx
	leal	1(%rcx), %esi
	movl	%edx, %ecx
	movl	%eax, %edx
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4(%rbp)
.L15:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L16
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	depthFirstSearch, .-depthFirstSearch
	.globl	visit
	.type	visit, @function
visit:
.LFB8:
	.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
	movl	%edi, -20(%rbp)
	movq	p(%rip), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	$1, 16(%rax)
	movl	timeOfSearch(%rip), %eax
	addl	$1, %eax
	movl	%eax, timeOfSearch(%rip)
	movq	d(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	timeOfSearch(%rip), %eax
	movl	%eax, (%rdx)
	movl	$0, -4(%rbp)
	jmp	.L20
.L22:
	movq	p(%rip), %rcx
	movq	p(%rip), %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rsi, %rax
	movq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	16(%rax), %eax
	testl	%eax, %eax
	jne	.L21
	movq	p(%rip), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %edi
	call	visit
.L21:
	addl	$1, -4(%rbp)
.L20:
	movq	p(%rip), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L22
	movq	p(%rip), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movl	$2, 16(%rax)
	movl	timeOfSearch(%rip), %eax
	addl	$1, %eax
	movl	%eax, timeOfSearch(%rip)
	movq	f(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	timeOfSearch(%rip), %eax
	movl	%eax, (%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	visit, .-visit
	.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:
