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>

int main(void)
{

	int i;
	int join_time[9], leave_time[9], ans[9];

	for(i = 0; i < 3; i++) {
		scanf("%d %d %d", &join_time[i], &join_time[i + 3], &join_time[i + 6]);
		scanf("%d %d %d", &leave_time[i], &leave_time[i + 3], &leave_time[i + 6]);
	}

	for(i = 0; i < 3; i++) {
		if(join_time[i + 6] > leave_time[i + 6]) {
			ans[i + 6] = leave_time[i + 6] + (60 - join_time[i + 6]);
			if(leave_time[i + 3] - 1 < 0) {
				leave_time[i + 3] = 59;
				leave_time[i]--;
			}
			else {
				leave_time[i + 3]--;
			}
		}
		else {
			ans[i + 6] = leave_time[i + 6] - join_time[i + 6];
		}
		if(join_time[i + 3] > leave_time[i + 3]) {
			ans[i + 3] = leave_time[i + 3] + (60 - join_time[i + 3]);
			leave_time[i]--;
		}
		else {
			ans[i + 3] = leave_time[i + 3] - join_time[i + 3];
		}
		ans[i] = leave_time[i] - join_time[i];
	}

	for(i = 0; i < 3; i++) {
		printf("%d %d %d\n", ans[i], ans[i + 3], ans[i + 6]);
	}

	return 0;

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$160, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -148(%rbp)
	jmp	.L2
.L3:
	movl	-148(%rbp), %eax
	addl	$6, %eax
	leaq	-144(%rbp), %rdx
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	leaq	-144(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-144(%rbp), %rsi
	movl	-148(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-148(%rbp), %eax
	addl	$6, %eax
	leaq	-96(%rbp), %rdx
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	leaq	-96(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-96(%rbp), %rsi
	movl	-148(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -148(%rbp)
.L2:
	cmpl	$2, -148(%rbp)
	jle	.L3
	movl	$0, -148(%rbp)
	jmp	.L4
.L10:
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-144(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	movl	$60, %ecx
	subl	%eax, %ecx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -48(%rbp,%rax,4)
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jg	.L6
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	$59, -96(%rbp,%rax,4)
	movl	-148(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-148(%rbp), %eax
	cltq
	movl	%edx, -96(%rbp,%rax,4)
	jmp	.L7
.L6:
	movl	-148(%rbp), %eax
	addl	$3, %eax
	movslq	%eax, %rdx
	movl	-96(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -96(%rbp,%rax,4)
	jmp	.L7
.L5:
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-144(%rbp,%rax,4), %ecx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	subl	%ecx, %edx
	cltq
	movl	%edx, -48(%rbp,%rax,4)
.L7:
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-144(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L8
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	movl	$60, %ecx
	subl	%eax, %ecx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -48(%rbp,%rax,4)
	movl	-148(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-148(%rbp), %eax
	cltq
	movl	%edx, -96(%rbp,%rax,4)
	jmp	.L9
.L8:
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-144(%rbp,%rax,4), %ecx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	subl	%ecx, %edx
	cltq
	movl	%edx, -48(%rbp,%rax,4)
.L9:
	movl	-148(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	subl	%eax, %edx
	movl	-148(%rbp), %eax
	cltq
	movl	%edx, -48(%rbp,%rax,4)
	addl	$1, -148(%rbp)
.L4:
	cmpl	$2, -148(%rbp)
	jle	.L10
	movl	$0, -148(%rbp)
	jmp	.L11
.L12:
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-48(%rbp,%rax,4), %ecx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-48(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -148(%rbp)
.L11:
	cmpl	$2, -148(%rbp)
	jle	.L12
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$152, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	leaq	48(%rsp), %rbp
	leaq	12(%rsp), %r13
.L2:
	leaq	24(%rbx), %rcx
	leaq	12(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__isoc99_scanf@PLT
	leaq	24(%rbp), %rcx
	leaq	12(%rbp), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r13, %rbx
	jne	.L2
	movl	24(%rsp), %ecx
	movl	72(%rsp), %edx
	movl	60(%rsp), %eax
	cmpl	%edx, %ecx
	jg	.L3
	subl	%ecx, %edx
	movl	%edx, 120(%rsp)
.L4:
	movl	12(%rsp), %ecx
	movl	48(%rsp), %edx
	cmpl	%ecx, %eax
	jl	.L6
	subl	%ecx, %eax
.L7:
	subl	(%rsp), %edx
	movl	28(%rsp), %ecx
	movl	%eax, 108(%rsp)
	movl	%edx, 96(%rsp)
	movl	76(%rsp), %edx
	movl	64(%rsp), %eax
	cmpl	%edx, %ecx
	jg	.L8
	subl	%ecx, %edx
	movl	%edx, 124(%rsp)
.L9:
	movl	16(%rsp), %ecx
	movl	52(%rsp), %edx
	cmpl	%ecx, %eax
	jl	.L11
	subl	%ecx, %eax
.L12:
	subl	4(%rsp), %edx
	movl	32(%rsp), %ecx
	movl	%eax, 112(%rsp)
	movl	%edx, 100(%rsp)
	movl	80(%rsp), %edx
	movl	68(%rsp), %eax
	cmpl	%edx, %ecx
	jle	.L13
	subl	%ecx, %edx
	addl	$60, %edx
	movl	%edx, 128(%rsp)
	testl	%eax, %eax
	jle	.L24
	subl	$1, %eax
	movl	%eax, 68(%rsp)
	jmp	.L15
.L3:
	subl	%ecx, %edx
	addl	$60, %edx
	movl	%edx, 120(%rsp)
	testl	%eax, %eax
	jle	.L5
	subl	$1, %eax
	movl	%eax, 60(%rsp)
	jmp	.L4
.L13:
	subl	%ecx, %edx
	movl	%edx, 128(%rsp)
.L15:
	movl	20(%rsp), %ecx
	movl	%eax, %esi
	movl	56(%rsp), %edx
	subl	%ecx, %esi
	cmpl	%eax, %ecx
	jle	.L17
	subl	$1, %edx
	leal	60(%rsi), %esi
	movl	%edx, 56(%rsp)
.L17:
	subl	8(%rsp), %edx
	movl	%esi, 116(%rsp)
	leaq	96(%rsp), %rbx
	leaq	108(%rsp), %r12
	movl	%edx, 104(%rsp)
	leaq	.LC1(%rip), %rbp
.L18:
	movl	12(%rbx), %ecx
	movl	24(%rbx), %r8d
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	(%rbx), %edx
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%r12, %rbx
	jne	.L18
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$152, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.L11:
	.cfi_restore_state
	subl	%ecx, %eax
	subl	$1, %edx
	movl	%edx, 52(%rsp)
	addl	$60, %eax
	jmp	.L12
.L8:
	subl	%ecx, %edx
	addl	$60, %edx
	movl	%edx, 124(%rsp)
	testl	%eax, %eax
	jle	.L10
	subl	$1, %eax
	movl	%eax, 64(%rsp)
	jmp	.L9
.L6:
	subl	%ecx, %eax
	subl	$1, %edx
	movl	%edx, 48(%rsp)
	addl	$60, %eax
	jmp	.L7
.L5:
	subl	$1, 48(%rsp)
	movl	$59, %eax
	movl	$59, 60(%rsp)
	jmp	.L4
.L24:
	subl	$1, 56(%rsp)
	movl	$59, %eax
	movl	$59, 68(%rsp)
	jmp	.L15
.L10:
	subl	$1, 52(%rsp)
	movl	$59, %eax
	movl	$59, 64(%rsp)
	jmp	.L9
.L25:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$152, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	leaq	48(%rsp), %rbp
	leaq	12(%rsp), %r13
.L2:
	leaq	24(%rbx), %rcx
	leaq	12(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__isoc99_scanf@PLT
	leaq	24(%rbp), %rcx
	leaq	12(%rbp), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r13, %rbx
	jne	.L2
	movl	24(%rsp), %ecx
	movl	72(%rsp), %edx
	movl	60(%rsp), %eax
	cmpl	%edx, %ecx
	jg	.L3
	subl	%ecx, %edx
	movl	%edx, 120(%rsp)
.L4:
	movl	12(%rsp), %ecx
	movl	48(%rsp), %edx
	cmpl	%ecx, %eax
	jl	.L6
	subl	%ecx, %eax
.L7:
	subl	(%rsp), %edx
	movl	28(%rsp), %ecx
	movl	%eax, 108(%rsp)
	movl	%edx, 96(%rsp)
	movl	76(%rsp), %edx
	movl	64(%rsp), %eax
	cmpl	%edx, %ecx
	jg	.L8
	subl	%ecx, %edx
	movl	%edx, 124(%rsp)
.L9:
	movl	16(%rsp), %ecx
	movl	52(%rsp), %edx
	cmpl	%ecx, %eax
	jl	.L11
	subl	%ecx, %eax
.L12:
	subl	4(%rsp), %edx
	movl	32(%rsp), %ecx
	movl	%eax, 112(%rsp)
	movl	%edx, 100(%rsp)
	movl	80(%rsp), %edx
	movl	68(%rsp), %eax
	cmpl	%edx, %ecx
	jle	.L13
	subl	%ecx, %edx
	addl	$60, %edx
	movl	%edx, 128(%rsp)
	testl	%eax, %eax
	jle	.L24
	subl	$1, %eax
	movl	%eax, 68(%rsp)
	jmp	.L15
.L3:
	subl	%ecx, %edx
	addl	$60, %edx
	movl	%edx, 120(%rsp)
	testl	%eax, %eax
	jle	.L5
	subl	$1, %eax
	movl	%eax, 60(%rsp)
	jmp	.L4
.L13:
	subl	%ecx, %edx
	movl	%edx, 128(%rsp)
.L15:
	movl	20(%rsp), %ecx
	movl	%eax, %esi
	movl	56(%rsp), %edx
	subl	%ecx, %esi
	cmpl	%eax, %ecx
	jle	.L17
	subl	$1, %edx
	leal	60(%rsi), %esi
	movl	%edx, 56(%rsp)
.L17:
	subl	8(%rsp), %edx
	movl	%esi, 116(%rsp)
	leaq	96(%rsp), %rbx
	leaq	108(%rsp), %r12
	movl	%edx, 104(%rsp)
	leaq	.LC1(%rip), %rbp
.L18:
	movl	12(%rbx), %ecx
	movl	24(%rbx), %r8d
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	(%rbx), %edx
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%r12, %rbx
	jne	.L18
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$152, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.L11:
	.cfi_restore_state
	subl	%ecx, %eax
	subl	$1, %edx
	movl	%edx, 52(%rsp)
	addl	$60, %eax
	jmp	.L12
.L8:
	subl	%ecx, %edx
	addl	$60, %edx
	movl	%edx, 124(%rsp)
	testl	%eax, %eax
	jle	.L10
	subl	$1, %eax
	movl	%eax, 64(%rsp)
	jmp	.L9
.L6:
	subl	%ecx, %eax
	subl	$1, %edx
	movl	%edx, 48(%rsp)
	addl	$60, %eax
	jmp	.L7
.L5:
	subl	$1, 48(%rsp)
	movl	$59, %eax
	movl	$59, 60(%rsp)
	jmp	.L4
.L24:
	subl	$1, 56(%rsp)
	movl	$59, %eax
	movl	$59, 68(%rsp)
	jmp	.L15
.L10:
	subl	$1, 52(%rsp)
	movl	$59, %eax
	movl	$59, 64(%rsp)
	jmp	.L9
.L25:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>

int main(void)
{

	int i;
	int join_time[9], leave_time[9], ans[9];

	for(i = 0; i < 3; i++) {
		scanf("%d %d %d", &join_time[i], &join_time[i + 3], &join_time[i + 6]);
		scanf("%d %d %d", &leave_time[i], &leave_time[i + 3], &leave_time[i + 6]);
	}

	for(i = 0; i < 3; i++) {
		if(join_time[i + 6] > leave_time[i + 6]) {
			ans[i + 6] = leave_time[i + 6] + (60 - join_time[i + 6]);
			if(leave_time[i + 3] - 1 < 0) {
				leave_time[i + 3] = 59;
				leave_time[i]--;
			}
			else {
				leave_time[i + 3]--;
			}
		}
		else {
			ans[i + 6] = leave_time[i + 6] - join_time[i + 6];
		}
		if(join_time[i + 3] > leave_time[i + 3]) {
			ans[i + 3] = leave_time[i + 3] + (60 - join_time[i + 3]);
			leave_time[i]--;
		}
		else {
			ans[i + 3] = leave_time[i + 3] - join_time[i + 3];
		}
		ans[i] = leave_time[i] - join_time[i];
	}

	for(i = 0; i < 3; i++) {
		printf("%d %d %d\n", ans[i], ans[i + 3], ans[i + 6]);
	}

	return 0;

}
9 0 0 18 0 0
9 0 1 18 0 0
9 14 52 12 15 30
 enoN
 9 0 0 0 0 0
9 0 1 18 0 0
9 14 52 12 15 30
 9 0 0 0 0 0
9 0 1 18 0 0
8 14 52 12 15 30
 9 0 0 0 0 0
9 0 1 18 0 0
8 14 86 12 15 30
 9 0 0 0 0 0
9 0 1 18 0 0
8 14 86 10 15 30
 9 0 0 0 0 0
9 0 0 18 0 0
8 14 86 10 15 30
 9 0 0 0 0 0
9 0 0 33 0 0
8 14 86 10 15 30
 9 0 0 0 0 0
9 0 0 33 0 0
8 14 130 10 15 30
 8 0 0 0 0 0
9 0 0 33 0 0
8 14 130 10 15 30

9 0 0
8 59 59
3 0 38
 1509367872 29295 -265606012
24585 3363 32767
-604452805 59 -264904645
 -9 0 0
8 59 59
3 0 38
 -9 0 0
8 59 59
4 0 38
 -9 0 0
8 59 59
4 0 4
 -9 0 0
8 59 59
2 0 4
 -9 0 0
9 0 0
2 0 4
 -9 0 0
24 0 0
2 0 4
 -9 0 0
24 0 0
2 0 -40
 -8 0 0
24 0 0
2 0 -40

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>

int main(void)
{

	int i;
	int join_time[9], leave_time[9], ans[9];

	for(i = 0; i < 3; i++) {
		scanf("%d %d %d", &join_time[i], &join_time[i + 3], &join_time[i + 6]);
		scanf("%d %d %d", &leave_time[i], &leave_time[i + 3], &leave_time[i + 6]);
	}

	for(i = 0; i < 3; i++) {
		if(join_time[i + 6] > leave_time[i + 6]) {
			ans[i + 6] = leave_time[i + 6] + (60 - join_time[i + 6]);
			if(leave_time[i + 3] - 1 < 0) {
				leave_time[i + 3] = 59;
				leave_time[i]--;
			}
			else {
				leave_time[i + 3]--;
			}
		}
		else {
			ans[i + 6] = leave_time[i + 6] - join_time[i + 6];
		}
		if(join_time[i + 3] > leave_time[i + 3]) {
			ans[i + 3] = leave_time[i + 3] + (60 - join_time[i + 3]);
			leave_time[i]--;
		}
		else {
			ans[i + 3] = leave_time[i + 3] - join_time[i + 3];
		}
		ans[i] = leave_time[i] - join_time[i];
	}

	for(i = 0; i < 3; i++) {
		printf("%d %d %d\n", ans[i], ans[i + 3], ans[i + 6]);
	}

	return 0;

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$160, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -148(%rbp)
	jmp	.L2
.L3:
	movl	-148(%rbp), %eax
	addl	$6, %eax
	leaq	-144(%rbp), %rdx
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	leaq	-144(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-144(%rbp), %rsi
	movl	-148(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-148(%rbp), %eax
	addl	$6, %eax
	leaq	-96(%rbp), %rdx
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	leaq	-96(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-96(%rbp), %rsi
	movl	-148(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -148(%rbp)
.L2:
	cmpl	$2, -148(%rbp)
	jle	.L3
	movl	$0, -148(%rbp)
	jmp	.L4
.L10:
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-144(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	movl	$60, %ecx
	subl	%eax, %ecx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -48(%rbp,%rax,4)
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jg	.L6
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	$59, -96(%rbp,%rax,4)
	movl	-148(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-148(%rbp), %eax
	cltq
	movl	%edx, -96(%rbp,%rax,4)
	jmp	.L7
.L6:
	movl	-148(%rbp), %eax
	addl	$3, %eax
	movslq	%eax, %rdx
	movl	-96(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -96(%rbp,%rax,4)
	jmp	.L7
.L5:
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-144(%rbp,%rax,4), %ecx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	subl	%ecx, %edx
	cltq
	movl	%edx, -48(%rbp,%rax,4)
.L7:
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-144(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L8
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	movl	$60, %ecx
	subl	%eax, %ecx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -48(%rbp,%rax,4)
	movl	-148(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-148(%rbp), %eax
	cltq
	movl	%edx, -96(%rbp,%rax,4)
	jmp	.L9
.L8:
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-144(%rbp,%rax,4), %ecx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	subl	%ecx, %edx
	cltq
	movl	%edx, -48(%rbp,%rax,4)
.L9:
	movl	-148(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	subl	%eax, %edx
	movl	-148(%rbp), %eax
	cltq
	movl	%edx, -48(%rbp,%rax,4)
	addl	$1, -148(%rbp)
.L4:
	cmpl	$2, -148(%rbp)
	jle	.L10
	movl	$0, -148(%rbp)
	jmp	.L11
.L12:
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-48(%rbp,%rax,4), %ecx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-48(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -148(%rbp)
.L11:
	cmpl	$2, -148(%rbp)
	jle	.L12
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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.
val
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$160, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -148(%rbp)
	jmp	.L2
.L3:
	movl	-148(%rbp), %eax
	addl	$6, %eax
	leaq	-144(%rbp), %rdx
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	leaq	-144(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-144(%rbp), %rsi
	movl	-148(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-148(%rbp), %eax
	addl	$6, %eax
	leaq	-96(%rbp), %rdx
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	leaq	-96(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-96(%rbp), %rsi
	movl	-148(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -148(%rbp)
.L2:
	cmpl	$2, -148(%rbp)
	jle	.L3
	movl	$0, -148(%rbp)
	jmp	.L4
.L10:
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-144(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	movl	$60, %ecx
	subl	%eax, %ecx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -48(%rbp,%rax,4)
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jg	.L6
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	$59, -96(%rbp,%rax,4)
	movl	-148(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-148(%rbp), %eax
	cltq
	movl	%edx, -96(%rbp,%rax,4)
	jmp	.L7
.L6:
	movl	-148(%rbp), %eax
	addl	$3, %eax
	movslq	%eax, %rdx
	movl	-96(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -96(%rbp,%rax,4)
	jmp	.L7
.L5:
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-144(%rbp,%rax,4), %ecx
	movl	-148(%rbp), %eax
	addl	$6, %eax
	subl	%ecx, %edx
	cltq
	movl	%edx, -48(%rbp,%rax,4)
.L7:
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-144(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L8
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	movl	$60, %ecx
	subl	%eax, %ecx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -48(%rbp,%rax,4)
	movl	-148(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-148(%rbp), %eax
	cltq
	movl	%edx, -96(%rbp,%rax,4)
	jmp	.L9
.L8:
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-144(%rbp,%rax,4), %ecx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	subl	%ecx, %edx
	cltq
	movl	%edx, -48(%rbp,%rax,4)
.L9:
	movl	-148(%rbp), %eax
	cltq
	movl	-96(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	subl	%eax, %edx
	movl	-148(%rbp), %eax
	cltq
	movl	%edx, -48(%rbp,%rax,4)
	addl	$1, -148(%rbp)
.L4:
	cmpl	$2, -148(%rbp)
	jle	.L10
	movl	$0, -148(%rbp)
	jmp	.L11
.L12:
	movl	-148(%rbp), %eax
	addl	$6, %eax
	cltq
	movl	-48(%rbp,%rax,4), %ecx
	movl	-148(%rbp), %eax
	addl	$3, %eax
	cltq
	movl	-48(%rbp,%rax,4), %edx
	movl	-148(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -148(%rbp)
.L11:
	cmpl	$2, -148(%rbp)
	jle	.L12
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
