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>
#include <string.h>
typedef struct point point;
typedef struct connection con;

typedef struct connection{
	point *conPoint;
	long long distance;
	con *nextCon;
}con;

typedef struct point{
	con *connection;
	int color;
	long long count;
}point;

void cal(point *num,con *connection){

	if(connection->conPoint->count == -1){
		connection->conPoint->count = num->count + connection->distance;
		cal(connection->conPoint,connection->conPoint->connection);
	}

	if(connection->nextCon == NULL){
		return;
	}
	cal(num,connection->nextCon);
	
}

void insert(point *p,int tempD,int tempP,int tempP2){
	con *connection = malloc(sizeof(con));
	connection->distance = tempD;
	connection->nextCon = p[tempP - 1].connection;
	p[tempP - 1].connection = connection;
	connection->conPoint = &p[tempP2 - 1];
}

int main(int argc, char **argv){
	int n = 0;
	int i = 0;
	int tempP = 0;
	int tempP2 = 0;
	long long tempD = 0;
	scanf("%d",&n);
	point *node = malloc(sizeof(point) * n);

	for(i = 0;i < n;i++){
		node[i].color = 0;
		node[i].connection = NULL;
		node[i].count = -1;
	}

	for(i = 0;i < n-1;i++){
		scanf("%d%d%d",&tempP,&tempP2,&tempD);
		insert(node,tempD,tempP,tempP2);
		insert(node,tempD,tempP2,tempP);
	}

	
	node[0].count = 0;
	cal(&node[0],node[0].connection);
	
	
	
	for(i = 1;i < n;i++){
		if(node[i].count % 2 == 1){
			node[i].color = 1;
		}
	}
	

	for(i = 0;i < n;i++){
		printf("%d\n",node[i].color);
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cal
	.type	cal, @function
cal:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movq	16(%rax), %rax
	cmpq	$-1, %rax
	jne	.L2
	movq	-8(%rbp), %rax
	movq	16(%rax), %rcx
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	addq	%rcx, %rdx
	movq	%rdx, 16(%rax)
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cal
.L2:
	movq	-16(%rbp), %rax
	movq	16(%rax), %rax
	testq	%rax, %rax
	je	.L5
	movq	-16(%rbp), %rax
	movq	16(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cal
	jmp	.L1
.L5:
	nop
.L1:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cal, .-cal
	.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	$48, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	%ecx, -36(%rbp)
	movl	$24, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	-24(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 16(%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	-24(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	-24(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, (%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	insert, .-insert
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movl	%edi, -52(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -40(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movq	$0, -24(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L8
.L9:
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, 8(%rax)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	$-1, 16(%rax)
	addl	$1, -28(%rbp)
.L8:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L9
	movl	$0, -28(%rbp)
	jmp	.L10
.L11:
	leaq	-24(%rbp), %rcx
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %ecx
	movl	-36(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%eax, %esi
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	insert
	movl	-36(%rbp), %ecx
	movl	-32(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%eax, %esi
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	insert
	addl	$1, -28(%rbp)
.L10:
	movl	-40(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -28(%rbp)
	jl	.L11
	movq	-16(%rbp), %rax
	movq	$0, 16(%rax)
	movq	-16(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cal
	movl	$1, -28(%rbp)
	jmp	.L12
.L14:
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	16(%rax), %rax
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	$1, %rax
	jne	.L13
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, 8(%rax)
.L13:
	addl	$1, -28(%rbp)
.L12:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L14
	movl	$0, -28(%rbp)
	jmp	.L15
.L16:
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -28(%rbp)
.L15:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	cal
	.type	cal, @function
cal:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %r11
	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
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, (%rsp)
.L20:
	movq	(%r11), %r9
	cmpq	$-1, 16(%r9)
	je	.L38
.L2:
	movq	16(%r11), %r11
	testq	%r11, %r11
	jne	.L20
	addq	$104, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L38:
	.cfi_restore_state
	movq	(%rsp), %rdi
	movq	8(%r11), %rax
	movq	%r9, 16(%rsp)
	movq	(%r9), %r10
	movq	%r11, 8(%rsp)
	addq	16(%rdi), %rax
	movq	%rax, 16(%r9)
	movq	%r10, %rbx
.L19:
	movq	(%rbx), %r10
	cmpq	$-1, 16(%r10)
	je	.L39
.L3:
	movq	16(%rbx), %rbx
	testq	%rbx, %rbx
	jne	.L19
	movq	8(%rsp), %r11
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L39:
	movq	16(%rsp), %rsi
	movq	8(%rbx), %rax
	movq	%r10, 32(%rsp)
	movq	(%r10), %r11
	movq	%rbx, 24(%rsp)
	addq	16(%rsi), %rax
	movq	%rax, 16(%r10)
	movq	%r11, %rbx
.L18:
	movq	(%rbx), %rdx
	cmpq	$-1, 16(%rdx)
	je	.L40
.L4:
	movq	16(%rbx), %rbx
	testq	%rbx, %rbx
	jne	.L18
	movq	24(%rsp), %rbx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L40:
	movq	32(%rsp), %rsi
	movq	8(%rbx), %rax
	movq	%rbx, %r11
	movq	(%rdx), %rbp
	addq	16(%rsi), %rax
	movq	%rax, 16(%rdx)
.L17:
	movq	0(%rbp), %rax
	cmpq	$-1, 16(%rax)
	je	.L41
.L5:
	movq	16(%rbp), %rbp
	testq	%rbp, %rbp
	jne	.L17
	movq	%r11, %rbx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L41:
	movq	8(%rbp), %rcx
	addq	16(%rdx), %rcx
	movq	%rbp, %r10
	movq	%rcx, 16(%rax)
	movq	(%rax), %r12
.L16:
	movq	(%r12), %rbp
	cmpq	$-1, 16(%rbp)
	je	.L42
.L6:
	movq	16(%r12), %r12
	testq	%r12, %r12
	jne	.L16
	movq	%r10, %rbp
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L42:
	movq	8(%r12), %rcx
	addq	16(%rax), %rcx
	movq	%r12, %r9
	movq	%rbp, %r8
	movq	%rcx, 16(%rbp)
	movq	0(%rbp), %rbx
.L15:
	movq	(%rbx), %rbp
	cmpq	$-1, 16(%rbp)
	je	.L43
.L7:
	movq	16(%rbx), %rbx
	testq	%rbx, %rbx
	jne	.L15
	movq	%r9, %r12
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L43:
	movq	8(%rbx), %rcx
	movq	0(%rbp), %r13
	addq	16(%r8), %rcx
	movq	%rcx, 16(%rbp)
	movq	%rbx, %rcx
	movq	%rbp, %rbx
.L14:
	movq	0(%r13), %r15
	cmpq	$-1, 16(%r15)
	je	.L44
.L8:
	movq	16(%r13), %r13
	testq	%r13, %r13
	jne	.L14
	movq	%rcx, %rbx
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L44:
	movq	8(%r13), %rsi
	addq	16(%rbx), %rsi
	movq	%r13, %rdi
	movq	%rdx, %r13
	movq	%rsi, 16(%r15)
	movq	(%r15), %r12
	movq	%rbx, %rdx
	movq	%r11, %rbx
	movq	%rdi, %r11
.L13:
	movq	(%r12), %r14
	cmpq	$-1, 16(%r14)
	je	.L45
.L9:
	movq	16(%r12), %r12
	testq	%r12, %r12
	jne	.L13
	movq	%r11, %rdi
	movq	%rbx, %r11
	movq	%rdx, %rbx
	movq	%r13, %rdx
	movq	%rdi, %r13
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L45:
	movq	8(%r12), %rsi
	addq	16(%r15), %rsi
	movq	%rsi, 16(%r14)
	movq	(%r14), %rbp
.L12:
	movq	0(%rbp), %rdi
	cmpq	$-1, 16(%rdi)
	je	.L46
.L10:
	movq	16(%rbp), %rbp
	testq	%rbp, %rbp
	je	.L9
	movq	0(%rbp), %rdi
	cmpq	$-1, 16(%rdi)
	jne	.L10
.L46:
	movq	8(%rbp), %rsi
	addq	16(%r14), %rsi
	movq	%r11, 88(%rsp)
	movq	%rsi, 16(%rdi)
	movq	(%rdi), %rsi
	movq	%rdx, 80(%rsp)
	movq	%rcx, 72(%rsp)
	movq	%r8, 64(%rsp)
	movq	%r9, 56(%rsp)
	movq	%rax, 48(%rsp)
	movq	%r10, 40(%rsp)
	call	cal
	movq	16(%rbp), %rbp
	movq	40(%rsp), %r10
	movq	48(%rsp), %rax
	movq	56(%rsp), %r9
	testq	%rbp, %rbp
	movq	64(%rsp), %r8
	movq	72(%rsp), %rcx
	movq	80(%rsp), %rdx
	movq	88(%rsp), %r11
	jne	.L12
	jmp	.L9
	.cfi_endproc
.LFE51:
	.size	cal, .-cal
	.p2align 4
	.globl	insert
	.type	insert, @function
insert:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdi, %r13
	movl	$24, %edi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%esi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	malloc@PLT
	movslq	%r12d, %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movq	%rbx, 8(%rax)
	leaq	-24(%r13,%rdx,8), %rdx
	movq	(%rdx), %rcx
	movq	%rax, (%rdx)
	movslq	%ebp, %rdx
	leaq	(%rdx,%rdx,2), %rdx
	leaq	-24(%r13,%rdx,8), %rdx
	movq	%rcx, 16(%rax)
	movq	%rdx, (%rax)
	addq	$8, %rsp
	.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
	.cfi_endproc
.LFE52:
	.size	insert, .-insert
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	movl	$0, 20(%rsp)
	movl	$0, 24(%rsp)
	movl	$0, 28(%rsp)
	movq	$0, 32(%rsp)
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %rax
	leaq	(%rax,%rax,2), %rdi
	movq	%rax, %rbp
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	testl	%ebp, %ebp
	jle	.L51
	movl	%ebp, %edx
	leaq	(%rdx,%rdx,2), %rdx
	leaq	(%rax,%rdx,8), %rdx
	.p2align 4,,10
	.p2align 3
.L53:
	movl	$0, 8(%rax)
	addq	$24, %rax
	movq	$0, -24(%rax)
	movq	$-1, -8(%rax)
	cmpq	%rdx, %rax
	jne	.L53
	cmpl	$1, %ebp
	jle	.L51
	leaq	28(%rsp), %rax
	xorl	%r14d, %r14d
	leaq	32(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L52:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movq	%r15, %rcx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %r13
	movl	$24, %edi
	movslq	28(%rsp), %r12
	movq	32(%rsp), %rbp
	call	malloc@PLT
	leaq	0(%r13,%r13,2), %rdx
	movl	$24, %edi
	leaq	-24(%rbx,%rdx,8), %r13
	movslq	%ebp, %rbp
	movq	0(%r13), %rdx
	movq	%rbp, 8(%rax)
	movq	%rax, 0(%r13)
	movq	%rdx, 16(%rax)
	leaq	(%r12,%r12,2), %rdx
	leaq	-24(%rbx,%rdx,8), %r12
	movq	%r12, (%rax)
	call	malloc@PLT
	movq	(%r12), %rdx
	movq	%rbp, 8(%rax)
	movl	20(%rsp), %ebp
	movq	%rdx, 16(%rax)
	movq	%rax, (%r12)
	movq	%r13, (%rax)
	leal	-1(%rbp), %eax
	cmpl	%r14d, %eax
	jg	.L52
	movq	$0, 16(%rbx)
	movq	(%rbx), %rsi
	movq	%rbx, %rdi
	call	cal
	cmpl	$1, %ebp
	jle	.L61
	leal	-2(%rbp), %eax
	leaq	32(%rbx), %rdx
	leaq	(%rax,%rax,2), %rax
	leaq	56(%rbx,%rax,8), %rsi
	.p2align 4,,10
	.p2align 3
.L59:
	movq	8(%rdx), %rax
	movq	%rax, %rcx
	shrq	$63, %rcx
	addq	%rcx, %rax
	andl	$1, %eax
	subq	%rcx, %rax
	cmpq	$1, %rax
	jne	.L58
	movl	$1, (%rdx)
.L58:
	addq	$24, %rdx
	cmpq	%rdx, %rsi
	jne	.L59
.L56:
	addq	$8, %rbx
	xorl	%ebp, %ebp
	leaq	.LC2(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L60:
	movl	(%rbx), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebp
	addq	$24, %rbx
	call	__printf_chk@PLT
	cmpl	%ebp, 20(%rsp)
	jg	.L60
.L57:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L74
	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
.L51:
	.cfi_restore_state
	movq	$0, 16(%rbx)
	movq	(%rbx), %rsi
	movq	%rbx, %rdi
	call	cal
.L61:
	subl	$1, %ebp
	jne	.L57
	jmp	.L56
.L74:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.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:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	cal
	.type	cal, @function
cal:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %r11
	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
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, (%rsp)
.L20:
	movq	(%r11), %r9
	cmpq	$-1, 16(%r9)
	je	.L38
.L2:
	movq	16(%r11), %r11
	testq	%r11, %r11
	jne	.L20
	addq	$104, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L38:
	.cfi_restore_state
	movq	(%rsp), %rdi
	movq	8(%r11), %rax
	movq	%r9, 16(%rsp)
	movq	(%r9), %r10
	movq	%r11, 8(%rsp)
	addq	16(%rdi), %rax
	movq	%rax, 16(%r9)
	movq	%r10, %rbx
.L19:
	movq	(%rbx), %r10
	cmpq	$-1, 16(%r10)
	je	.L39
.L3:
	movq	16(%rbx), %rbx
	testq	%rbx, %rbx
	jne	.L19
	movq	8(%rsp), %r11
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L39:
	movq	16(%rsp), %rsi
	movq	8(%rbx), %rax
	movq	%r10, 32(%rsp)
	movq	(%r10), %r11
	movq	%rbx, 24(%rsp)
	addq	16(%rsi), %rax
	movq	%rax, 16(%r10)
	movq	%r11, %rbx
.L18:
	movq	(%rbx), %rdx
	cmpq	$-1, 16(%rdx)
	je	.L40
.L4:
	movq	16(%rbx), %rbx
	testq	%rbx, %rbx
	jne	.L18
	movq	24(%rsp), %rbx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L40:
	movq	32(%rsp), %rsi
	movq	8(%rbx), %rax
	movq	%rbx, %r11
	movq	(%rdx), %rbp
	addq	16(%rsi), %rax
	movq	%rax, 16(%rdx)
.L17:
	movq	0(%rbp), %rax
	cmpq	$-1, 16(%rax)
	je	.L41
.L5:
	movq	16(%rbp), %rbp
	testq	%rbp, %rbp
	jne	.L17
	movq	%r11, %rbx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L41:
	movq	8(%rbp), %rcx
	addq	16(%rdx), %rcx
	movq	%rbp, %r10
	movq	%rcx, 16(%rax)
	movq	(%rax), %r12
.L16:
	movq	(%r12), %rbp
	cmpq	$-1, 16(%rbp)
	je	.L42
.L6:
	movq	16(%r12), %r12
	testq	%r12, %r12
	jne	.L16
	movq	%r10, %rbp
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L42:
	movq	8(%r12), %rcx
	addq	16(%rax), %rcx
	movq	%r12, %r9
	movq	%rbp, %r8
	movq	%rcx, 16(%rbp)
	movq	0(%rbp), %rbx
.L15:
	movq	(%rbx), %rbp
	cmpq	$-1, 16(%rbp)
	je	.L43
.L7:
	movq	16(%rbx), %rbx
	testq	%rbx, %rbx
	jne	.L15
	movq	%r9, %r12
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L43:
	movq	8(%rbx), %rcx
	movq	0(%rbp), %r13
	addq	16(%r8), %rcx
	movq	%rcx, 16(%rbp)
	movq	%rbx, %rcx
	movq	%rbp, %rbx
.L14:
	movq	0(%r13), %r15
	cmpq	$-1, 16(%r15)
	je	.L44
.L8:
	movq	16(%r13), %r13
	testq	%r13, %r13
	jne	.L14
	movq	%rcx, %rbx
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L44:
	movq	8(%r13), %rsi
	addq	16(%rbx), %rsi
	movq	%r13, %rdi
	movq	%rdx, %r13
	movq	%rsi, 16(%r15)
	movq	(%r15), %r12
	movq	%rbx, %rdx
	movq	%r11, %rbx
	movq	%rdi, %r11
.L13:
	movq	(%r12), %r14
	cmpq	$-1, 16(%r14)
	je	.L45
.L9:
	movq	16(%r12), %r12
	testq	%r12, %r12
	jne	.L13
	movq	%r11, %rdi
	movq	%rbx, %r11
	movq	%rdx, %rbx
	movq	%r13, %rdx
	movq	%rdi, %r13
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L45:
	movq	8(%r12), %rsi
	addq	16(%r15), %rsi
	movq	%rsi, 16(%r14)
	movq	(%r14), %rbp
.L12:
	movq	0(%rbp), %rdi
	cmpq	$-1, 16(%rdi)
	je	.L46
.L10:
	movq	16(%rbp), %rbp
	testq	%rbp, %rbp
	je	.L9
	movq	0(%rbp), %rdi
	cmpq	$-1, 16(%rdi)
	jne	.L10
.L46:
	movq	8(%rbp), %rsi
	addq	16(%r14), %rsi
	movq	%r11, 88(%rsp)
	movq	%rsi, 16(%rdi)
	movq	(%rdi), %rsi
	movq	%rdx, 80(%rsp)
	movq	%rcx, 72(%rsp)
	movq	%r8, 64(%rsp)
	movq	%r9, 56(%rsp)
	movq	%rax, 48(%rsp)
	movq	%r10, 40(%rsp)
	call	cal
	movq	16(%rbp), %rbp
	movq	40(%rsp), %r10
	movq	48(%rsp), %rax
	movq	56(%rsp), %r9
	testq	%rbp, %rbp
	movq	64(%rsp), %r8
	movq	72(%rsp), %rcx
	movq	80(%rsp), %rdx
	movq	88(%rsp), %r11
	jne	.L12
	jmp	.L9
	.cfi_endproc
.LFE51:
	.size	cal, .-cal
	.p2align 4
	.globl	insert
	.type	insert, @function
insert:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdi, %r13
	movl	$24, %edi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%esi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	malloc@PLT
	movslq	%r12d, %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movq	%rbx, 8(%rax)
	leaq	-24(%r13,%rdx,8), %rdx
	movq	(%rdx), %rcx
	movq	%rax, (%rdx)
	movslq	%ebp, %rdx
	leaq	(%rdx,%rdx,2), %rdx
	leaq	-24(%r13,%rdx,8), %rdx
	movq	%rcx, 16(%rax)
	movq	%rdx, (%rax)
	addq	$8, %rsp
	.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
	.cfi_endproc
.LFE52:
	.size	insert, .-insert
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	movl	$0, 20(%rsp)
	movl	$0, 24(%rsp)
	movl	$0, 28(%rsp)
	movq	$0, 32(%rsp)
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %rax
	leaq	(%rax,%rax,2), %rdi
	movq	%rax, %rbp
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	testl	%ebp, %ebp
	jle	.L51
	movl	%ebp, %edx
	leaq	(%rdx,%rdx,2), %rdx
	leaq	(%rax,%rdx,8), %rdx
	.p2align 4,,10
	.p2align 3
.L53:
	movl	$0, 8(%rax)
	addq	$24, %rax
	movq	$0, -24(%rax)
	movq	$-1, -8(%rax)
	cmpq	%rdx, %rax
	jne	.L53
	cmpl	$1, %ebp
	jle	.L51
	leaq	28(%rsp), %rax
	xorl	%r14d, %r14d
	leaq	32(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L52:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movq	%r15, %rcx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %r13
	movl	$24, %edi
	movslq	28(%rsp), %r12
	movq	32(%rsp), %rbp
	call	malloc@PLT
	leaq	0(%r13,%r13,2), %rdx
	movl	$24, %edi
	leaq	-24(%rbx,%rdx,8), %r13
	movslq	%ebp, %rbp
	movq	0(%r13), %rdx
	movq	%rbp, 8(%rax)
	movq	%rax, 0(%r13)
	movq	%rdx, 16(%rax)
	leaq	(%r12,%r12,2), %rdx
	leaq	-24(%rbx,%rdx,8), %r12
	movq	%r12, (%rax)
	call	malloc@PLT
	movq	(%r12), %rdx
	movq	%rbp, 8(%rax)
	movl	20(%rsp), %ebp
	movq	%rdx, 16(%rax)
	movq	%rax, (%r12)
	movq	%r13, (%rax)
	leal	-1(%rbp), %eax
	cmpl	%r14d, %eax
	jg	.L52
	movq	$0, 16(%rbx)
	movq	(%rbx), %rsi
	movq	%rbx, %rdi
	call	cal
	cmpl	$1, %ebp
	jle	.L61
	leal	-2(%rbp), %eax
	leaq	32(%rbx), %rdx
	leaq	(%rax,%rax,2), %rax
	leaq	56(%rbx,%rax,8), %rsi
	.p2align 4,,10
	.p2align 3
.L59:
	movq	8(%rdx), %rax
	movq	%rax, %rcx
	shrq	$63, %rcx
	addq	%rcx, %rax
	andl	$1, %eax
	subq	%rcx, %rax
	cmpq	$1, %rax
	jne	.L58
	movl	$1, (%rdx)
.L58:
	addq	$24, %rdx
	cmpq	%rdx, %rsi
	jne	.L59
.L56:
	addq	$8, %rbx
	xorl	%ebp, %ebp
	leaq	.LC2(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L60:
	movl	(%rbx), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebp
	addq	$24, %rbx
	call	__printf_chk@PLT
	cmpl	%ebp, 20(%rsp)
	jg	.L60
.L57:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L74
	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
.L51:
	.cfi_restore_state
	movq	$0, 16(%rbx)
	movq	(%rbx), %rsi
	movq	%rbx, %rdi
	call	cal
.L61:
	subl	$1, %ebp
	jne	.L57
	jmp	.L56
.L74:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.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:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct point point;
typedef struct connection con;

typedef struct connection{
	point *conPoint;
	long long distance;
	con *nextCon;
}con;

typedef struct point{
	con *connection;
	int color;
	long long count;
}point;

void cal(point *num,con *connection){

	if(connection->conPoint->count == -1){
		connection->conPoint->count = num->count + connection->distance;
		cal(connection->conPoint,connection->conPoint->connection);
	}

	if(connection->nextCon == NULL){
		return;
	}
	cal(num,connection->nextCon);
	
}

void insert(point *p,int tempD,int tempP,int tempP2){
	con *connection = malloc(sizeof(con));
	connection->distance = tempD;
	connection->nextCon = p[tempP - 1].connection;
	p[tempP - 1].connection = connection;
	connection->conPoint = &p[tempP2 - 1];
}

int main(int argc, char **argv){
	int n = 0;
	int i = 0;
	int tempP = 0;
	int tempP2 = 0;
	long long tempD = 0;
	scanf("%d",&n);
	point *node = malloc(sizeof(point) * n);

	for(i = 0;i < n;i++){
		node[i].color = 0;
		node[i].connection = NULL;
		node[i].count = -1;
	}

	for(i = 0;i < n-1;i++){
		scanf("%d%d%d",&tempP,&tempP2,&tempD);
		insert(node,tempD,tempP,tempP2);
		insert(node,tempD,tempP2,tempP);
	}

	
	node[0].count = 0;
	cal(&node[0],node[0].connection);
	
	
	
	for(i = 1;i < n;i++){
		if(node[i].count % 2 == 1){
			node[i].color = 1;
		}
	}
	

	for(i = 0;i < n;i++){
		printf("%d\n",node[i].color);
	}
}
5
2 5 2
2 3 18
1 3 8
3 4 2
 3
1 2 2
2 3 0
 3
1 2 4
2 3 1
 3
1 2 3
2 3 0
 3
1 2 3
2 3 1
 5
2 5 3
2 3 18
1 3 8
3 4 2
 5
2 5 3
2 3 18
1 3 8
3 4 3
 5
1 5 3
2 3 23
1 3 8
3 4 2
 5
3 5 3
2 3 15
1 3 8
5 4 2
 5
2 5 3
2 1 18
1 3 1
2 4 1

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

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>
#include <string.h>
typedef struct point point;
typedef struct connection con;

typedef struct connection{
	point *conPoint;
	long long distance;
	con *nextCon;
}con;

typedef struct point{
	con *connection;
	int color;
	long long count;
}point;

void cal(point *num,con *connection){

	if(connection->conPoint->count == -1){
		connection->conPoint->count = num->count + connection->distance;
		cal(connection->conPoint,connection->conPoint->connection);
	}

	if(connection->nextCon == NULL){
		return;
	}
	cal(num,connection->nextCon);
	
}

void insert(point *p,int tempD,int tempP,int tempP2){
	con *connection = malloc(sizeof(con));
	connection->distance = tempD;
	connection->nextCon = p[tempP - 1].connection;
	p[tempP - 1].connection = connection;
	connection->conPoint = &p[tempP2 - 1];
}

int main(int argc, char **argv){
	int n = 0;
	int i = 0;
	int tempP = 0;
	int tempP2 = 0;
	long long tempD = 0;
	scanf("%d",&n);
	point *node = malloc(sizeof(point) * n);

	for(i = 0;i < n;i++){
		node[i].color = 0;
		node[i].connection = NULL;
		node[i].count = -1;
	}

	for(i = 0;i < n-1;i++){
		scanf("%d%d%d",&tempP,&tempP2,&tempD);
		insert(node,tempD,tempP,tempP2);
		insert(node,tempD,tempP2,tempP);
	}

	
	node[0].count = 0;
	cal(&node[0],node[0].connection);
	
	
	
	for(i = 1;i < n;i++){
		if(node[i].count % 2 == 1){
			node[i].color = 1;
		}
	}
	

	for(i = 0;i < n;i++){
		printf("%d\n",node[i].color);
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cal
	.type	cal, @function
cal:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movq	16(%rax), %rax
	cmpq	$-1, %rax
	jne	.L2
	movq	-8(%rbp), %rax
	movq	16(%rax), %rcx
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	addq	%rcx, %rdx
	movq	%rdx, 16(%rax)
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cal
.L2:
	movq	-16(%rbp), %rax
	movq	16(%rax), %rax
	testq	%rax, %rax
	je	.L5
	movq	-16(%rbp), %rax
	movq	16(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cal
	jmp	.L1
.L5:
	nop
.L1:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cal, .-cal
	.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	$48, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	%ecx, -36(%rbp)
	movl	$24, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	-24(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 16(%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	-24(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	-24(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, (%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	insert, .-insert
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movl	%edi, -52(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -40(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movq	$0, -24(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L8
.L9:
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, 8(%rax)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	$-1, 16(%rax)
	addl	$1, -28(%rbp)
.L8:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L9
	movl	$0, -28(%rbp)
	jmp	.L10
.L11:
	leaq	-24(%rbp), %rcx
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %ecx
	movl	-36(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%eax, %esi
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	insert
	movl	-36(%rbp), %ecx
	movl	-32(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%eax, %esi
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	insert
	addl	$1, -28(%rbp)
.L10:
	movl	-40(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -28(%rbp)
	jl	.L11
	movq	-16(%rbp), %rax
	movq	$0, 16(%rax)
	movq	-16(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cal
	movl	$1, -28(%rbp)
	jmp	.L12
.L14:
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	16(%rax), %rax
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	$1, %rax
	jne	.L13
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, 8(%rax)
.L13:
	addl	$1, -28(%rbp)
.L12:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L14
	movl	$0, -28(%rbp)
	jmp	.L15
.L16:
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -28(%rbp)
.L15:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	cal
	.type	cal, @function
cal:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movq	16(%rax), %rax
	cmpq	$-1, %rax
	jne	.L2
	movq	-8(%rbp), %rax
	movq	16(%rax), %rcx
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	addq	%rcx, %rdx
	movq	%rdx, 16(%rax)
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cal
.L2:
	movq	-16(%rbp), %rax
	movq	16(%rax), %rax
	testq	%rax, %rax
	je	.L5
	movq	-16(%rbp), %rax
	movq	16(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cal
	jmp	.L1
.L5:
	nop
.L1:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cal, .-cal
	.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	$48, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	%ecx, -36(%rbp)
	movl	$24, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	-24(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 16(%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	-24(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	-24(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, (%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	insert, .-insert
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movl	%edi, -52(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -40(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movq	$0, -24(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L8
.L9:
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, 8(%rax)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	$-1, 16(%rax)
	addl	$1, -28(%rbp)
.L8:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L9
	movl	$0, -28(%rbp)
	jmp	.L10
.L11:
	leaq	-24(%rbp), %rcx
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %ecx
	movl	-36(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%eax, %esi
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	insert
	movl	-36(%rbp), %ecx
	movl	-32(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%eax, %esi
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	insert
	addl	$1, -28(%rbp)
.L10:
	movl	-40(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -28(%rbp)
	jl	.L11
	movq	-16(%rbp), %rax
	movq	$0, 16(%rax)
	movq	-16(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cal
	movl	$1, -28(%rbp)
	jmp	.L12
.L14:
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	16(%rax), %rax
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	$1, %rax
	jne	.L13
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, 8(%rax)
.L13:
	addl	$1, -28(%rbp)
.L12:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L14
	movl	$0, -28(%rbp)
	jmp	.L15
.L16:
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -28(%rbp)
.L15:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
