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>
struct node {
  int id;
  struct node* next;
};

struct node **list;
int *seq, *group, *stack, counter, phase, except,sp;

void Insert(int, int);
int strongcomponent(int);
int main(void)
{
  int i, v, e,s ,t, q;
  scanf("%d %d", &v, &e);
  list = (struct node**)malloc(sizeof(struct node*) * v);
  seq = (int*)calloc(v, sizeof(int));
  group = (int*)malloc(sizeof(int) * v);
  stack = (int*)malloc(sizeof(int) * v);
  except = v + 1;
  for (i = 0; i < v; i++) {
    list[i] = NULL;
    group[i] = -1;
  }
  for (i = 0; i < e; i++) {
    scanf("%d %d", &s, &t);
    Insert(s,t);
  }
  for (i = 0; i < v; i++) {
    if (!seq[i]) {
      strongcomponent(i);
    }
  }
  scanf("%d", &q);
  for (i = 0; i < q; i++) {
    scanf("%d %d", &s, &t);
    if (group[s] == group[t]) printf("1\n");
    else printf("0\n");
  }
  for (i = 0; i < v; i++) free(list[i]);
  free(seq);
  free(group);
  free(stack);
}
void Insert(int a, int b)
{
  struct node *p = (struct node*)malloc(sizeof(struct node));
  p->id = b;
  p->next = list[a];
  list[a] = p;
}
int strongcomponent(int point)
{
  int min;
  struct node *n;
  counter++;
  min = seq[point] = counter;
  stack[sp++] = point;
  for (n = list[point]; n != NULL; n = n->next) {
    int m;
    if (!seq[n->id]) m = strongcomponent(n->id);
    else m = seq[n->id];
    if (m < min) min = m;
  }
  if (min == seq[point]) {
    int x;
    do {
      sp--;
      x = stack[sp];
      group[x] = phase;
      seq[x] = except;
    } while (x != point);
    phase++;
  }
  return min;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	list
	.bss
	.align 8
	.type	list, @object
	.size	list, 8
list:
	.zero	8
	.globl	seq
	.align 8
	.type	seq, @object
	.size	seq, 8
seq:
	.zero	8
	.globl	group
	.align 8
	.type	group, @object
	.size	group, 8
group:
	.zero	8
	.globl	stack
	.align 8
	.type	stack, @object
	.size	stack, 8
stack:
	.zero	8
	.globl	counter
	.align 4
	.type	counter, @object
	.size	counter, 4
counter:
	.zero	4
	.globl	phase
	.align 4
	.type	phase, @object
	.size	phase, 4
phase:
	.zero	4
	.globl	except
	.align 4
	.type	except, @object
	.size	except, 4
except:
	.zero	4
	.globl	sp
	.align 4
	.type	sp, @object
	.size	sp, 4
sp:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"1"
.LC3:
	.string	"0"
	.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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, list(%rip)
	movl	-32(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, seq(%rip)
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, group(%rip)
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, stack(%rip)
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movl	%eax, except(%rip)
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	movq	list(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
	movq	group(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -12(%rbp)
.L2:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L3
	movl	$0, -12(%rbp)
	jmp	.L4
.L5:
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	Insert
	addl	$1, -12(%rbp)
.L4:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L5
	movl	$0, -12(%rbp)
	jmp	.L6
.L8:
	movq	seq(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L7
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	strongcomponent
.L7:
	addl	$1, -12(%rbp)
.L6:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L8
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L9
.L12:
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	group(%rip), %rdx
	movl	-24(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	group(%rip), %rcx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L10
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L11
.L10:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L11:
	addl	$1, -12(%rbp)
.L9:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	movl	$0, -12(%rbp)
	jmp	.L13
.L14:
	movq	list(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	addl	$1, -12(%rbp)
.L13:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L14
	movq	seq(%rip), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	group(%rip), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	stack(%rip), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	Insert
	.type	Insert, @function
Insert:
.LFB7:
	.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)
	movl	%esi, -24(%rbp)
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	-24(%rbp), %edx
	movl	%edx, (%rax)
	movq	list(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	list(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	Insert, .-Insert
	.globl	strongcomponent
	.type	strongcomponent, @function
strongcomponent:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	counter(%rip), %eax
	addl	$1, %eax
	movl	%eax, counter(%rip)
	movq	seq(%rip), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	counter(%rip), %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	movl	%eax, -20(%rbp)
	movq	stack(%rip), %rcx
	movl	sp(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sp(%rip)
	cltq
	salq	$2, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rdx)
	movq	list(%rip), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L19
.L23:
	movq	seq(%rip), %rdx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L20
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, %edi
	call	strongcomponent
	movl	%eax, -16(%rbp)
	jmp	.L21
.L20:
	movq	seq(%rip), %rdx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -16(%rbp)
.L21:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jge	.L22
	movl	-16(%rbp), %eax
	movl	%eax, -20(%rbp)
.L22:
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
.L19:
	cmpq	$0, -8(%rbp)
	jne	.L23
	movq	seq(%rip), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L24
.L25:
	movl	sp(%rip), %eax
	subl	$1, %eax
	movl	%eax, sp(%rip)
	movq	stack(%rip), %rdx
	movl	sp(%rip), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movq	group(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	phase(%rip), %eax
	movl	%eax, (%rdx)
	movq	seq(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	except(%rip), %eax
	movl	%eax, (%rdx)
	movl	-12(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jne	.L25
	movl	phase(%rip), %eax
	addl	$1, %eax
	movl	%eax, phase(%rip)
.L24:
	movl	-20(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	strongcomponent, .-strongcomponent
	.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	Insert
	.type	Insert, @function
Insert:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%edi, %rbx
	movl	$16, %edi
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	call	malloc@PLT
	movq	list(%rip), %rdx
	movl	%ebp, (%rax)
	leaq	(%rdx,%rbx,8), %rdx
	movq	(%rdx), %rcx
	movq	%rcx, 8(%rax)
	movq	%rax, (%rdx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE40:
	.size	Insert, .-Insert
	.p2align 4
	.globl	strongcomponent
	.type	strongcomponent, @function
strongcomponent:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rdx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdx, %r13
	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
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	counter(%rip), %eax
	movq	seq(%rip), %rbp
	movq	stack(%rip), %r14
	leal	1(%rax), %r12d
	leaq	0(%rbp,%rdx,4), %r15
	movl	%r12d, counter(%rip)
	movl	%r12d, (%r15)
	movslq	sp(%rip), %rax
	leal	1(%rax), %ecx
	movl	%ecx, sp(%rip)
	movl	%edx, (%r14,%rax,4)
	movq	list(%rip), %rax
	movq	(%rax,%rdx,8), %rbx
	testq	%rbx, %rbx
	je	.L5
.L8:
	movslq	(%rbx), %rax
	movq	%rax, %rdi
	movl	0(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L19
.L6:
	movq	8(%rbx), %rbx
	cmpl	%eax, %r12d
	cmovg	%eax, %r12d
	testq	%rbx, %rbx
	jne	.L8
.L5:
	cmpl	(%r15), %r12d
	je	.L20
.L4:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r12d, %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
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	call	strongcomponent
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	movq	group(%rip), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	movl	sp(%rip), %eax
	movl	phase(%rip), %ecx
	subl	$1, %eax
	movl	%eax, sp(%rip)
	cltq
	movslq	(%r14,%rax,4), %rdx
	movl	%ecx, (%rsi,%rdx,4)
	movl	except(%rip), %ecx
	movl	%ecx, 0(%rbp,%rdx,4)
	cmpl	%edx, %r13d
	jne	.L10
	addl	$1, phase(%rip)
	jmp	.L4
	.cfi_endproc
.LFE41:
	.size	strongcomponent, .-strongcomponent
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"1"
.LC3:
	.string	"0"
	.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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %r14
	leaq	0(,%r14,8), %r15
	movq	%r14, %rbx
	movq	%r15, %rdi
	call	malloc@PLT
	movl	$4, %esi
	movq	%r14, %rdi
	salq	$2, %r14
	movq	%rax, list(%rip)
	movq	%rax, %r13
	call	calloc@PLT
	movq	%r14, %rdi
	movq	%rax, seq(%rip)
	call	malloc@PLT
	movq	%r14, %rdi
	movq	%rax, group(%rip)
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rax, stack(%rip)
	leal	1(%rbx), %eax
	movl	%eax, except(%rip)
	testl	%ebx, %ebx
	jle	.L25
	movq	%r15, %rdx
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	memset@PLT
	movq	%r14, %rdx
	movl	$255, %esi
	movq	%r12, %rdi
	call	memset@PLT
.L25:
	movl	8(%rsp), %esi
	xorl	%r14d, %r14d
	leaq	16(%rsp), %r13
	leaq	12(%rsp), %r12
	testl	%esi, %esi
	jle	.L24
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	$16, %edi
	movl	16(%rsp), %r15d
	movslq	12(%rsp), %rbx
	call	malloc@PLT
	movq	list(%rip), %rdx
	addl	$1, %r14d
	movl	%r15d, (%rax)
	leaq	(%rdx,%rbx,8), %rdx
	movq	(%rdx), %rcx
	movq	%rcx, 8(%rax)
	movq	%rax, (%rdx)
	cmpl	%r14d, 8(%rsp)
	jg	.L23
.L24:
	movl	4(%rsp), %eax
	movq	seq(%rip), %r9
	xorl	%r8d, %r8d
	testl	%eax, %eax
	jle	.L27
	.p2align 4,,10
	.p2align 3
.L32:
	movl	(%r9,%r8,4), %edx
	movl	%r8d, %edi
	testl	%edx, %edx
	je	.L49
	addq	$1, %r8
	cmpl	%r8d, %eax
	jg	.L32
.L27:
	leaq	20(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	leaq	16(%rsp), %r13
	leaq	12(%rsp), %r12
	leaq	.LC3(%rip), %r14
	leaq	.LC2(%rip), %r15
	testl	%ecx, %ecx
	jle	.L29
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	16(%rsp), %rdx
	movslq	12(%rsp), %rcx
	movq	group(%rip), %rax
	movl	(%rax,%rdx,4), %esi
	cmpl	%esi, (%rax,%rcx,4)
	je	.L50
	movq	%r14, %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	%ebx, 20(%rsp)
	jg	.L28
.L29:
	movl	4(%rsp), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jle	.L34
	.p2align 4,,10
	.p2align 3
.L33:
	movq	list(%rip), %rax
	movq	(%rax,%rbx,8), %rdi
	addq	$1, %rbx
	call	free@PLT
	cmpl	%ebx, 4(%rsp)
	jg	.L33
.L34:
	movq	seq(%rip), %rdi
	call	free@PLT
	movq	group(%rip), %rdi
	call	free@PLT
	movq	stack(%rip), %rdi
	call	free@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$40, %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
	.p2align 4,,10
	.p2align 3
.L50:
	.cfi_restore_state
	movq	%r15, %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	20(%rsp), %ebx
	jl	.L28
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L49:
	call	strongcomponent
	movl	4(%rsp), %eax
	addq	$1, %r8
	cmpl	%r8d, %eax
	jg	.L32
	jmp	.L27
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	sp
	.bss
	.align 4
	.type	sp, @object
	.size	sp, 4
sp:
	.zero	4
	.globl	except
	.align 4
	.type	except, @object
	.size	except, 4
except:
	.zero	4
	.globl	phase
	.align 4
	.type	phase, @object
	.size	phase, 4
phase:
	.zero	4
	.globl	counter
	.align 4
	.type	counter, @object
	.size	counter, 4
counter:
	.zero	4
	.globl	stack
	.align 8
	.type	stack, @object
	.size	stack, 8
stack:
	.zero	8
	.globl	group
	.align 8
	.type	group, @object
	.size	group, 8
group:
	.zero	8
	.globl	seq
	.align 8
	.type	seq, @object
	.size	seq, 8
seq:
	.zero	8
	.globl	list
	.align 8
	.type	list, @object
	.size	list, 8
list:
	.zero	8
	.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	Insert
	.type	Insert, @function
Insert:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%edi, %rbx
	movl	$16, %edi
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	call	malloc@PLT
	movq	list(%rip), %rdx
	movl	%ebp, (%rax)
	leaq	(%rdx,%rbx,8), %rdx
	movq	(%rdx), %rcx
	movq	%rcx, 8(%rax)
	movq	%rax, (%rdx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE40:
	.size	Insert, .-Insert
	.p2align 4
	.globl	strongcomponent
	.type	strongcomponent, @function
strongcomponent:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rdx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdx, %r13
	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
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	counter(%rip), %eax
	movq	seq(%rip), %rbp
	movq	stack(%rip), %r14
	leal	1(%rax), %r12d
	leaq	0(%rbp,%rdx,4), %r15
	movl	%r12d, counter(%rip)
	movl	%r12d, (%r15)
	movslq	sp(%rip), %rax
	leal	1(%rax), %ecx
	movl	%ecx, sp(%rip)
	movl	%edx, (%r14,%rax,4)
	movq	list(%rip), %rax
	movq	(%rax,%rdx,8), %rbx
	testq	%rbx, %rbx
	je	.L5
.L8:
	movslq	(%rbx), %rax
	movq	%rax, %rdi
	movl	0(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L19
.L6:
	movq	8(%rbx), %rbx
	cmpl	%eax, %r12d
	cmovg	%eax, %r12d
	testq	%rbx, %rbx
	jne	.L8
.L5:
	cmpl	(%r15), %r12d
	je	.L20
.L4:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r12d, %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
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	call	strongcomponent
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	movq	group(%rip), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	movl	sp(%rip), %eax
	movl	phase(%rip), %ecx
	subl	$1, %eax
	movl	%eax, sp(%rip)
	cltq
	movslq	(%r14,%rax,4), %rdx
	movl	%ecx, (%rsi,%rdx,4)
	movl	except(%rip), %ecx
	movl	%ecx, 0(%rbp,%rdx,4)
	cmpl	%edx, %r13d
	jne	.L10
	addl	$1, phase(%rip)
	jmp	.L4
	.cfi_endproc
.LFE41:
	.size	strongcomponent, .-strongcomponent
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"1"
.LC3:
	.string	"0"
	.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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %r14
	leaq	0(,%r14,8), %r15
	movq	%r14, %rbx
	movq	%r15, %rdi
	call	malloc@PLT
	movl	$4, %esi
	movq	%r14, %rdi
	salq	$2, %r14
	movq	%rax, list(%rip)
	movq	%rax, %r13
	call	calloc@PLT
	movq	%r14, %rdi
	movq	%rax, seq(%rip)
	call	malloc@PLT
	movq	%r14, %rdi
	movq	%rax, group(%rip)
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rax, stack(%rip)
	leal	1(%rbx), %eax
	movl	%eax, except(%rip)
	testl	%ebx, %ebx
	jle	.L25
	movq	%r15, %rdx
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	memset@PLT
	movq	%r14, %rdx
	movl	$255, %esi
	movq	%r12, %rdi
	call	memset@PLT
.L25:
	movl	8(%rsp), %esi
	xorl	%r14d, %r14d
	leaq	16(%rsp), %r13
	leaq	12(%rsp), %r12
	testl	%esi, %esi
	jle	.L24
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	$16, %edi
	movl	16(%rsp), %r15d
	movslq	12(%rsp), %rbx
	call	malloc@PLT
	movq	list(%rip), %rdx
	addl	$1, %r14d
	movl	%r15d, (%rax)
	leaq	(%rdx,%rbx,8), %rdx
	movq	(%rdx), %rcx
	movq	%rcx, 8(%rax)
	movq	%rax, (%rdx)
	cmpl	%r14d, 8(%rsp)
	jg	.L23
.L24:
	movl	4(%rsp), %eax
	movq	seq(%rip), %r9
	xorl	%r8d, %r8d
	testl	%eax, %eax
	jle	.L27
	.p2align 4,,10
	.p2align 3
.L32:
	movl	(%r9,%r8,4), %edx
	movl	%r8d, %edi
	testl	%edx, %edx
	je	.L49
	addq	$1, %r8
	cmpl	%r8d, %eax
	jg	.L32
.L27:
	leaq	20(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	leaq	16(%rsp), %r13
	leaq	12(%rsp), %r12
	leaq	.LC3(%rip), %r14
	leaq	.LC2(%rip), %r15
	testl	%ecx, %ecx
	jle	.L29
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	16(%rsp), %rdx
	movslq	12(%rsp), %rcx
	movq	group(%rip), %rax
	movl	(%rax,%rdx,4), %esi
	cmpl	%esi, (%rax,%rcx,4)
	je	.L50
	movq	%r14, %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	%ebx, 20(%rsp)
	jg	.L28
.L29:
	movl	4(%rsp), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jle	.L34
	.p2align 4,,10
	.p2align 3
.L33:
	movq	list(%rip), %rax
	movq	(%rax,%rbx,8), %rdi
	addq	$1, %rbx
	call	free@PLT
	cmpl	%ebx, 4(%rsp)
	jg	.L33
.L34:
	movq	seq(%rip), %rdi
	call	free@PLT
	movq	group(%rip), %rdi
	call	free@PLT
	movq	stack(%rip), %rdi
	call	free@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$40, %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
	.p2align 4,,10
	.p2align 3
.L50:
	.cfi_restore_state
	movq	%r15, %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	20(%rsp), %ebx
	jl	.L28
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L49:
	call	strongcomponent
	movl	4(%rsp), %eax
	addq	$1, %r8
	cmpl	%r8d, %eax
	jg	.L32
	jmp	.L27
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	sp
	.bss
	.align 4
	.type	sp, @object
	.size	sp, 4
sp:
	.zero	4
	.globl	except
	.align 4
	.type	except, @object
	.size	except, 4
except:
	.zero	4
	.globl	phase
	.align 4
	.type	phase, @object
	.size	phase, 4
phase:
	.zero	4
	.globl	counter
	.align 4
	.type	counter, @object
	.size	counter, 4
counter:
	.zero	4
	.globl	stack
	.align 8
	.type	stack, @object
	.size	stack, 8
stack:
	.zero	8
	.globl	group
	.align 8
	.type	group, @object
	.size	group, 8
group:
	.zero	8
	.globl	seq
	.align 8
	.type	seq, @object
	.size	seq, 8
seq:
	.zero	8
	.globl	list
	.align 8
	.type	list, @object
	.size	list, 8
list:
	.zero	8
	.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>
struct node {
  int id;
  struct node* next;
};

struct node **list;
int *seq, *group, *stack, counter, phase, except,sp;

void Insert(int, int);
int strongcomponent(int);
int main(void)
{
  int i, v, e,s ,t, q;
  scanf("%d %d", &v, &e);
  list = (struct node**)malloc(sizeof(struct node*) * v);
  seq = (int*)calloc(v, sizeof(int));
  group = (int*)malloc(sizeof(int) * v);
  stack = (int*)malloc(sizeof(int) * v);
  except = v + 1;
  for (i = 0; i < v; i++) {
    list[i] = NULL;
    group[i] = -1;
  }
  for (i = 0; i < e; i++) {
    scanf("%d %d", &s, &t);
    Insert(s,t);
  }
  for (i = 0; i < v; i++) {
    if (!seq[i]) {
      strongcomponent(i);
    }
  }
  scanf("%d", &q);
  for (i = 0; i < q; i++) {
    scanf("%d %d", &s, &t);
    if (group[s] == group[t]) printf("1\n");
    else printf("0\n");
  }
  for (i = 0; i < v; i++) free(list[i]);
  free(seq);
  free(group);
  free(stack);
}
void Insert(int a, int b)
{
  struct node *p = (struct node*)malloc(sizeof(struct node));
  p->id = b;
  p->next = list[a];
  list[a] = p;
}
int strongcomponent(int point)
{
  int min;
  struct node *n;
  counter++;
  min = seq[point] = counter;
  stack[sp++] = point;
  for (n = list[point]; n != NULL; n = n->next) {
    int m;
    if (!seq[n->id]) m = strongcomponent(n->id);
    else m = seq[n->id];
    if (m < min) min = m;
  }
  if (min == seq[point]) {
    int x;
    do {
      sp--;
      x = stack[sp];
      group[x] = phase;
      seq[x] = except;
    } while (x != point);
    phase++;
  }
  return min;
}

5 6
0 1
1 0
0 2
2 4
4 3
3 2
4
0 1
0 3
2 3
3 4
 5 6
0 1
1 0
1 2
2 4
4 3
3 2
4
0 1
0 3
2 0
3 4
 5 6
0 1
1 0
1 2
2 4
4 0
3 2
4
0 1
0 3
2 0
3 4
 5 6
0 1
1 0
1 2
2 4
1 1
3 2
4
0 1
0 3
2 0
3 4
 7 6
0 1
1 0
1 2
2 4
4 3
3 2
4
1 2
0 3
2 3
3 4
 5 6
0 0
1 0
1 2
2 4
4 0
3 2
4
0 1
0 3
2 0
3 4
 5 6
0 1
1 0
1 2
2 4
4 1
3 2
4
0 1
0 0
2 0
3 4
 5 6
0 1
1 0
1 2
2 4
1 1
3 2
3
0 1
0 3
2 0
3 4
 5 6
0 0
1 0
1 2
2 4
4 0
0 2
4
0 1
0 3
2 0
3 4
 5 6
0 1
1 0
1 0
2 4
4 1
3 2
4
0 1
0 0
2 0
3 4

1
0
1
1
 1
0
0
1
 1
0
1
0
 1
0
0
0
 0
0
1
1
 0
0
0
0
 1
1
1
0
 1
0
0
 0
0
1
0
 1
1
0
0

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>
struct node {
  int id;
  struct node* next;
};

struct node **list;
int *seq, *group, *stack, counter, phase, except,sp;

void Insert(int, int);
int strongcomponent(int);
int main(void)
{
  int i, v, e,s ,t, q;
  scanf("%d %d", &v, &e);
  list = (struct node**)malloc(sizeof(struct node*) * v);
  seq = (int*)calloc(v, sizeof(int));
  group = (int*)malloc(sizeof(int) * v);
  stack = (int*)malloc(sizeof(int) * v);
  except = v + 1;
  for (i = 0; i < v; i++) {
    list[i] = NULL;
    group[i] = -1;
  }
  for (i = 0; i < e; i++) {
    scanf("%d %d", &s, &t);
    Insert(s,t);
  }
  for (i = 0; i < v; i++) {
    if (!seq[i]) {
      strongcomponent(i);
    }
  }
  scanf("%d", &q);
  for (i = 0; i < q; i++) {
    scanf("%d %d", &s, &t);
    if (group[s] == group[t]) printf("1\n");
    else printf("0\n");
  }
  for (i = 0; i < v; i++) free(list[i]);
  free(seq);
  free(group);
  free(stack);
}
void Insert(int a, int b)
{
  struct node *p = (struct node*)malloc(sizeof(struct node));
  p->id = b;
  p->next = list[a];
  list[a] = p;
}
int strongcomponent(int point)
{
  int min;
  struct node *n;
  counter++;
  min = seq[point] = counter;
  stack[sp++] = point;
  for (n = list[point]; n != NULL; n = n->next) {
    int m;
    if (!seq[n->id]) m = strongcomponent(n->id);
    else m = seq[n->id];
    if (m < min) min = m;
  }
  if (min == seq[point]) {
    int x;
    do {
      sp--;
      x = stack[sp];
      group[x] = phase;
      seq[x] = except;
    } while (x != point);
    phase++;
  }
  return min;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	list
	.bss
	.align 8
	.type	list, @object
	.size	list, 8
list:
	.zero	8
	.globl	seq
	.align 8
	.type	seq, @object
	.size	seq, 8
seq:
	.zero	8
	.globl	group
	.align 8
	.type	group, @object
	.size	group, 8
group:
	.zero	8
	.globl	stack
	.align 8
	.type	stack, @object
	.size	stack, 8
stack:
	.zero	8
	.globl	counter
	.align 4
	.type	counter, @object
	.size	counter, 4
counter:
	.zero	4
	.globl	phase
	.align 4
	.type	phase, @object
	.size	phase, 4
phase:
	.zero	4
	.globl	except
	.align 4
	.type	except, @object
	.size	except, 4
except:
	.zero	4
	.globl	sp
	.align 4
	.type	sp, @object
	.size	sp, 4
sp:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"1"
.LC3:
	.string	"0"
	.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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, list(%rip)
	movl	-32(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, seq(%rip)
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, group(%rip)
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, stack(%rip)
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movl	%eax, except(%rip)
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	movq	list(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
	movq	group(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -12(%rbp)
.L2:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L3
	movl	$0, -12(%rbp)
	jmp	.L4
.L5:
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	Insert
	addl	$1, -12(%rbp)
.L4:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L5
	movl	$0, -12(%rbp)
	jmp	.L6
.L8:
	movq	seq(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L7
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	strongcomponent
.L7:
	addl	$1, -12(%rbp)
.L6:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L8
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L9
.L12:
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	group(%rip), %rdx
	movl	-24(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	group(%rip), %rcx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L10
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L11
.L10:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L11:
	addl	$1, -12(%rbp)
.L9:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	movl	$0, -12(%rbp)
	jmp	.L13
.L14:
	movq	list(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	addl	$1, -12(%rbp)
.L13:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L14
	movq	seq(%rip), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	group(%rip), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	stack(%rip), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	Insert
	.type	Insert, @function
Insert:
.LFB7:
	.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)
	movl	%esi, -24(%rbp)
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	-24(%rbp), %edx
	movl	%edx, (%rax)
	movq	list(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	list(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	Insert, .-Insert
	.globl	strongcomponent
	.type	strongcomponent, @function
strongcomponent:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	counter(%rip), %eax
	addl	$1, %eax
	movl	%eax, counter(%rip)
	movq	seq(%rip), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	counter(%rip), %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	movl	%eax, -20(%rbp)
	movq	stack(%rip), %rcx
	movl	sp(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sp(%rip)
	cltq
	salq	$2, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rdx)
	movq	list(%rip), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L19
.L23:
	movq	seq(%rip), %rdx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L20
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, %edi
	call	strongcomponent
	movl	%eax, -16(%rbp)
	jmp	.L21
.L20:
	movq	seq(%rip), %rdx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -16(%rbp)
.L21:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jge	.L22
	movl	-16(%rbp), %eax
	movl	%eax, -20(%rbp)
.L22:
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
.L19:
	cmpq	$0, -8(%rbp)
	jne	.L23
	movq	seq(%rip), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L24
.L25:
	movl	sp(%rip), %eax
	subl	$1, %eax
	movl	%eax, sp(%rip)
	movq	stack(%rip), %rdx
	movl	sp(%rip), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movq	group(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	phase(%rip), %eax
	movl	%eax, (%rdx)
	movq	seq(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	except(%rip), %eax
	movl	%eax, (%rdx)
	movl	-12(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jne	.L25
	movl	phase(%rip), %eax
	addl	$1, %eax
	movl	%eax, phase(%rip)
.L24:
	movl	-20(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	strongcomponent, .-strongcomponent
	.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	list
	.bss
	.align 8
	.type	list, @object
	.size	list, 8
list:
	.zero	8
	.globl	seq
	.align 8
	.type	seq, @object
	.size	seq, 8
seq:
	.zero	8
	.globl	group
	.align 8
	.type	group, @object
	.size	group, 8
group:
	.zero	8
	.globl	stack
	.align 8
	.type	stack, @object
	.size	stack, 8
stack:
	.zero	8
	.globl	counter
	.align 4
	.type	counter, @object
	.size	counter, 4
counter:
	.zero	4
	.globl	phase
	.align 4
	.type	phase, @object
	.size	phase, 4
phase:
	.zero	4
	.globl	except
	.align 4
	.type	except, @object
	.size	except, 4
except:
	.zero	4
	.globl	sp
	.align 4
	.type	sp, @object
	.size	sp, 4
sp:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"1"
.LC3:
	.string	"0"
	.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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, list(%rip)
	movl	-32(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, seq(%rip)
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, group(%rip)
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, stack(%rip)
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movl	%eax, except(%rip)
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	movq	list(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
	movq	group(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -12(%rbp)
.L2:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L3
	movl	$0, -12(%rbp)
	jmp	.L4
.L5:
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	Insert
	addl	$1, -12(%rbp)
.L4:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L5
	movl	$0, -12(%rbp)
	jmp	.L6
.L8:
	movq	seq(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L7
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	strongcomponent
.L7:
	addl	$1, -12(%rbp)
.L6:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L8
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L9
.L12:
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	group(%rip), %rdx
	movl	-24(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	group(%rip), %rcx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L10
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L11
.L10:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L11:
	addl	$1, -12(%rbp)
.L9:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	movl	$0, -12(%rbp)
	jmp	.L13
.L14:
	movq	list(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	addl	$1, -12(%rbp)
.L13:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L14
	movq	seq(%rip), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	group(%rip), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	stack(%rip), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	Insert
	.type	Insert, @function
Insert:
.LFB7:
	.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)
	movl	%esi, -24(%rbp)
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	-24(%rbp), %edx
	movl	%edx, (%rax)
	movq	list(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	list(%rip), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	Insert, .-Insert
	.globl	strongcomponent
	.type	strongcomponent, @function
strongcomponent:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	counter(%rip), %eax
	addl	$1, %eax
	movl	%eax, counter(%rip)
	movq	seq(%rip), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	counter(%rip), %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	movl	%eax, -20(%rbp)
	movq	stack(%rip), %rcx
	movl	sp(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sp(%rip)
	cltq
	salq	$2, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rdx)
	movq	list(%rip), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L19
.L23:
	movq	seq(%rip), %rdx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L20
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, %edi
	call	strongcomponent
	movl	%eax, -16(%rbp)
	jmp	.L21
.L20:
	movq	seq(%rip), %rdx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -16(%rbp)
.L21:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jge	.L22
	movl	-16(%rbp), %eax
	movl	%eax, -20(%rbp)
.L22:
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
.L19:
	cmpq	$0, -8(%rbp)
	jne	.L23
	movq	seq(%rip), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L24
.L25:
	movl	sp(%rip), %eax
	subl	$1, %eax
	movl	%eax, sp(%rip)
	movq	stack(%rip), %rdx
	movl	sp(%rip), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movq	group(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	phase(%rip), %eax
	movl	%eax, (%rdx)
	movq	seq(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	except(%rip), %eax
	movl	%eax, (%rdx)
	movl	-12(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jne	.L25
	movl	phase(%rip), %eax
	addl	$1, %eax
	movl	%eax, phase(%rip)
.L24:
	movl	-20(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	strongcomponent, .-strongcomponent
	.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:
