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 calc(int h, int m){
	return h*60+m;
}

int main(){
	int time,time2,a,b,e,f,i,N,M,h[500],m[500], count=0;
	scanf("%d",&N);
	
	for(a=0;a<N;a++){
		scanf("%d %d",&h[a],&m[a]);
	}
	
	scanf("%d",&M);
	
	for(b=0;b<M;b++){
		scanf("%d %d",&h[b+a],&m[b+a]);
	}
	
	for(e=0;e<N+M;e++){
		for(f=e+1;f<N+M;f++){
			/*
			if(h[e]>h[f]){
				i=h[e];
				h[e]=h[f];
				h[f]=i;
				i=m[e];
				m[e]=m[f];
				m[f]=i;
			}else if(h[e]==h[f]){
				if(m[e]>m[f]){
					i=m[e];
					m[e]=m[f];
					m[f]=i;
				}
			}
			*/
			if(calc(h[e], m[e]) > calc(h[f], m[f])){
				i=h[e];
				h[e]=h[f];
				h[f]=i;
				i=m[e];
				m[e]=m[f];
				m[f]=i;
			}
		}
	}
	
	
	for(e=0;e<N+M;e++){
		if(!e || h[e]!=h[e-1]||m[e]!=m[e-1]){
			if(count!=0){
				printf(" ");
			}
			count++;
			printf("%d:%02d",h[e],m[e]);
		}
	}
	printf("\n");
	
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	imull	$60, %eax, %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d:%02d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$4056, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$0, -4040(%rbp)
	leaq	-4064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4056(%rbp)
	jmp	.L4
.L5:
	leaq	-2032(%rbp), %rdx
	movl	-4056(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-4032(%rbp), %rcx
	movl	-4056(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4056(%rbp)
.L4:
	movl	-4064(%rbp), %eax
	cmpl	%eax, -4056(%rbp)
	jl	.L5
	leaq	-4060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4052(%rbp)
	jmp	.L6
.L7:
	movl	-4052(%rbp), %edx
	movl	-4056(%rbp), %eax
	addl	%edx, %eax
	leaq	-2032(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-4052(%rbp), %ecx
	movl	-4056(%rbp), %eax
	addl	%ecx, %eax
	leaq	-4032(%rbp), %rcx
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4052(%rbp)
.L6:
	movl	-4060(%rbp), %eax
	cmpl	%eax, -4052(%rbp)
	jl	.L7
	movl	$0, -4048(%rbp)
	jmp	.L8
.L12:
	movl	-4048(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4044(%rbp)
	jmp	.L9
.L11:
	movl	-4048(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	movl	%eax, %ebx
	movl	-4044(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4044(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	cmpl	%eax, %ebx
	jle	.L10
	movl	-4048(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	movl	%eax, -4036(%rbp)
	movl	-4044(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	cltq
	movl	%edx, -4032(%rbp,%rax,4)
	movl	-4044(%rbp), %eax
	cltq
	movl	-4036(%rbp), %edx
	movl	%edx, -4032(%rbp,%rax,4)
	movl	-4048(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %eax
	movl	%eax, -4036(%rbp)
	movl	-4044(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	cltq
	movl	%edx, -2032(%rbp,%rax,4)
	movl	-4044(%rbp), %eax
	cltq
	movl	-4036(%rbp), %edx
	movl	%edx, -2032(%rbp,%rax,4)
.L10:
	addl	$1, -4044(%rbp)
.L9:
	movl	-4064(%rbp), %edx
	movl	-4060(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4044(%rbp)
	jl	.L11
	addl	$1, -4048(%rbp)
.L8:
	movl	-4064(%rbp), %edx
	movl	-4060(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4048(%rbp)
	jl	.L12
	movl	$0, -4048(%rbp)
	jmp	.L13
.L17:
	cmpl	$0, -4048(%rbp)
	je	.L14
	movl	-4048(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L14
	movl	-4048(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-2032(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L15
.L14:
	cmpl	$0, -4040(%rbp)
	je	.L16
	movl	$32, %edi
	call	putchar@PLT
.L16:
	addl	$1, -4040(%rbp)
	movl	-4048(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L15:
	addl	$1, -4048(%rbp)
.L13:
	movl	-4064(%rbp), %edx
	movl	-4060(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4048(%rbp)
	jl	.L17
	movl	$10, %edi
	call	putchar@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	calc
	.type	calc, @function
calc:
.LFB23:
	.cfi_startproc
	endbr64
	imull	$60, %edi, %edi
	leal	(%rdi,%rsi), %eax
	ret
	.cfi_endproc
.LFE23:
	.size	calc, .-calc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d:%02d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r15, %rdi
	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	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %eax
	testl	%eax, %eax
	jle	.L19
	xorl	%r14d, %r14d
	xorl	%ebp, %ebp
	leaq	2048(%rsp), %rbx
	leaq	48(%rsp), %r12
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	(%rbx,%r14), %rdx
	leaq	(%r12,%r14), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	$1, %ebp
	addq	$4, %r14
	cmpl	%ebp, 40(%rsp)
	jg	.L5
.L4:
	leaq	44(%rsp), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r14d
	testl	%r14d, %r14d
	jle	.L6
	movslq	%ebp, %rbp
	xorl	%r15d, %r15d
	leaq	2048(%rsp), %rbx
	salq	$2, %rbp
	leaq	48(%rsp), %r12
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	(%rbx,%rbp), %rdx
	leaq	(%r12,%rbp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r14d
	addl	$1, %r15d
	addq	$4, %rbp
	cmpl	%r15d, %r14d
	jg	.L7
.L6:
	movl	40(%rsp), %r15d
	leal	(%r14,%r15), %r12d
	testl	%r12d, %r12d
	jle	.L8
	leal	1(%r12), %edi
	leal	-1(%r12), %eax
	movl	%r15d, 24(%rsp)
	movl	$1, %r13d
	leaq	2048(%rsp), %rbx
	movq	%rdi, 8(%rsp)
	leaq	52(%rsp), %rbp
	movq	%rbx, 16(%rsp)
	leaq	2052(%rsp), %rdi
	movq	%rbx, %r11
	movl	%r14d, 28(%rsp)
	movq	%rdi, %r15
	movl	%eax, %r14d
	.p2align 4,,10
	.p2align 3
.L10:
	cmpl	%r13d, %r12d
	jle	.L14
	movl	%r14d, %eax
	movq	%rbp, %rsi
	subl	%r13d, %eax
	leaq	-1(%r13,%rax), %rax
	leaq	(%r15,%rax,4), %rbx
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L13:
	movl	-4(%rbp), %r9d
	movl	(%rsi), %r10d
	movl	(%r11), %edi
	movl	4(%rax), %r8d
	imull	$60, %r10d, %ecx
	imull	$60, %r9d, %edx
	addl	%r8d, %ecx
	addl	%edi, %edx
	cmpl	%edx, %ecx
	jge	.L12
	movl	%r10d, -4(%rbp)
	movl	%r8d, (%r11)
	movl	%r9d, (%rsi)
	movl	%edi, 4(%rax)
.L12:
	addq	$4, %rax
	addq	$4, %rsi
	cmpq	%rax, %rbx
	jne	.L13
.L14:
	addq	$1, %r13
	addq	$4, %r11
	addq	$4, %rbp
	cmpq	%r13, 8(%rsp)
	jne	.L10
	movq	16(%rsp), %rbx
	movl	24(%rsp), %r15d
	xorl	%ebp, %ebp
	xorl	%r13d, %r13d
	movl	28(%rsp), %r14d
	leaq	48(%rsp), %r12
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%rbx,%rbp,4), %ecx
	movl	(%r12,%rbp,4), %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	addl	$1, %r13d
	call	__printf_chk@PLT
	movl	44(%rsp), %r14d
	movl	40(%rsp), %r15d
.L16:
	addq	$1, %rbp
	leal	(%r15,%r14), %eax
	cmpl	%ebp, %eax
	jle	.L8
.L11:
	testq	%rbp, %rbp
	je	.L15
	movl	-4(%r12,%rbp,4), %eax
	cmpl	%eax, (%r12,%rbp,4)
	je	.L33
.L15:
	testl	%r13d, %r13d
	je	.L17
	movl	$32, %edi
	call	putchar@PLT
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L33:
	movl	-4(%rbx,%rbp,4), %eax
	cmpl	%eax, (%rbx,%rbp,4)
	jne	.L15
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L8:
	movl	$10, %edi
	call	putchar@PLT
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$4072, %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
.L19:
	.cfi_restore_state
	xorl	%ebp, %ebp
	jmp	.L4
.L34:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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	calc
	.type	calc, @function
calc:
.LFB23:
	.cfi_startproc
	endbr64
	imull	$60, %edi, %edi
	leal	(%rdi,%rsi), %eax
	ret
	.cfi_endproc
.LFE23:
	.size	calc, .-calc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d:%02d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r15, %rdi
	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	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %eax
	testl	%eax, %eax
	jle	.L19
	xorl	%r14d, %r14d
	xorl	%ebp, %ebp
	leaq	2048(%rsp), %rbx
	leaq	48(%rsp), %r12
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	(%rbx,%r14), %rdx
	leaq	(%r12,%r14), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	$1, %ebp
	addq	$4, %r14
	cmpl	%ebp, 40(%rsp)
	jg	.L5
.L4:
	leaq	44(%rsp), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r14d
	testl	%r14d, %r14d
	jle	.L6
	movslq	%ebp, %rbp
	xorl	%r15d, %r15d
	leaq	2048(%rsp), %rbx
	salq	$2, %rbp
	leaq	48(%rsp), %r12
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	(%rbx,%rbp), %rdx
	leaq	(%r12,%rbp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r14d
	addl	$1, %r15d
	addq	$4, %rbp
	cmpl	%r15d, %r14d
	jg	.L7
.L6:
	movl	40(%rsp), %r15d
	leal	(%r14,%r15), %r12d
	testl	%r12d, %r12d
	jle	.L8
	leal	1(%r12), %edi
	leal	-1(%r12), %eax
	movl	%r15d, 24(%rsp)
	movl	$1, %r13d
	leaq	2048(%rsp), %rbx
	movq	%rdi, 8(%rsp)
	leaq	52(%rsp), %rbp
	movq	%rbx, 16(%rsp)
	leaq	2052(%rsp), %rdi
	movq	%rbx, %r11
	movl	%r14d, 28(%rsp)
	movq	%rdi, %r15
	movl	%eax, %r14d
	.p2align 4,,10
	.p2align 3
.L10:
	cmpl	%r13d, %r12d
	jle	.L14
	movl	%r14d, %eax
	movq	%rbp, %rsi
	subl	%r13d, %eax
	leaq	-1(%r13,%rax), %rax
	leaq	(%r15,%rax,4), %rbx
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L13:
	movl	-4(%rbp), %r9d
	movl	(%rsi), %r10d
	movl	(%r11), %edi
	movl	4(%rax), %r8d
	imull	$60, %r10d, %ecx
	imull	$60, %r9d, %edx
	addl	%r8d, %ecx
	addl	%edi, %edx
	cmpl	%edx, %ecx
	jge	.L12
	movl	%r10d, -4(%rbp)
	movl	%r8d, (%r11)
	movl	%r9d, (%rsi)
	movl	%edi, 4(%rax)
.L12:
	addq	$4, %rax
	addq	$4, %rsi
	cmpq	%rax, %rbx
	jne	.L13
.L14:
	addq	$1, %r13
	addq	$4, %r11
	addq	$4, %rbp
	cmpq	%r13, 8(%rsp)
	jne	.L10
	movq	16(%rsp), %rbx
	movl	24(%rsp), %r15d
	xorl	%ebp, %ebp
	xorl	%r13d, %r13d
	movl	28(%rsp), %r14d
	leaq	48(%rsp), %r12
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%rbx,%rbp,4), %ecx
	movl	(%r12,%rbp,4), %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	addl	$1, %r13d
	call	__printf_chk@PLT
	movl	44(%rsp), %r14d
	movl	40(%rsp), %r15d
.L16:
	addq	$1, %rbp
	leal	(%r15,%r14), %eax
	cmpl	%ebp, %eax
	jle	.L8
.L11:
	testq	%rbp, %rbp
	je	.L15
	movl	-4(%r12,%rbp,4), %eax
	cmpl	%eax, (%r12,%rbp,4)
	je	.L33
.L15:
	testl	%r13d, %r13d
	je	.L17
	movl	$32, %edi
	call	putchar@PLT
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L33:
	movl	-4(%rbx,%rbp,4), %eax
	cmpl	%eax, (%rbx,%rbp,4)
	jne	.L15
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L8:
	movl	$10, %edi
	call	putchar@PLT
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$4072, %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
.L19:
	.cfi_restore_state
	xorl	%ebp, %ebp
	jmp	.L4
.L34:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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 calc(int h, int m){
	return h*60+m;
}

int main(){
	int time,time2,a,b,e,f,i,N,M,h[500],m[500], count=0;
	scanf("%d",&N);
	
	for(a=0;a<N;a++){
		scanf("%d %d",&h[a],&m[a]);
	}
	
	scanf("%d",&M);
	
	for(b=0;b<M;b++){
		scanf("%d %d",&h[b+a],&m[b+a]);
	}
	
	for(e=0;e<N+M;e++){
		for(f=e+1;f<N+M;f++){
			/*
			if(h[e]>h[f]){
				i=h[e];
				h[e]=h[f];
				h[f]=i;
				i=m[e];
				m[e]=m[f];
				m[f]=i;
			}else if(h[e]==h[f]){
				if(m[e]>m[f]){
					i=m[e];
					m[e]=m[f];
					m[f]=i;
				}
			}
			*/
			if(calc(h[e], m[e]) > calc(h[f], m[f])){
				i=h[e];
				h[e]=h[f];
				h[f]=i;
				i=m[e];
				m[e]=m[f];
				m[f]=i;
			}
		}
	}
	
	
	for(e=0;e<N+M;e++){
		if(!e || h[e]!=h[e-1]||m[e]!=m[e-1]){
			if(count!=0){
				printf(" ");
			}
			count++;
			printf("%d:%02d",h[e],m[e]);
		}
	}
	printf("\n");
	
return 0;
}
2 9 8 15 59
1 8 27

8:27 9:08 15:59

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 calc(int h, int m){
	return h*60+m;
}

int main(){
	int time,time2,a,b,e,f,i,N,M,h[500],m[500], count=0;
	scanf("%d",&N);
	
	for(a=0;a<N;a++){
		scanf("%d %d",&h[a],&m[a]);
	}
	
	scanf("%d",&M);
	
	for(b=0;b<M;b++){
		scanf("%d %d",&h[b+a],&m[b+a]);
	}
	
	for(e=0;e<N+M;e++){
		for(f=e+1;f<N+M;f++){
			/*
			if(h[e]>h[f]){
				i=h[e];
				h[e]=h[f];
				h[f]=i;
				i=m[e];
				m[e]=m[f];
				m[f]=i;
			}else if(h[e]==h[f]){
				if(m[e]>m[f]){
					i=m[e];
					m[e]=m[f];
					m[f]=i;
				}
			}
			*/
			if(calc(h[e], m[e]) > calc(h[f], m[f])){
				i=h[e];
				h[e]=h[f];
				h[f]=i;
				i=m[e];
				m[e]=m[f];
				m[f]=i;
			}
		}
	}
	
	
	for(e=0;e<N+M;e++){
		if(!e || h[e]!=h[e-1]||m[e]!=m[e-1]){
			if(count!=0){
				printf(" ");
			}
			count++;
			printf("%d:%02d",h[e],m[e]);
		}
	}
	printf("\n");
	
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	imull	$60, %eax, %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d:%02d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$4056, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$0, -4040(%rbp)
	leaq	-4064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4056(%rbp)
	jmp	.L4
.L5:
	leaq	-2032(%rbp), %rdx
	movl	-4056(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-4032(%rbp), %rcx
	movl	-4056(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4056(%rbp)
.L4:
	movl	-4064(%rbp), %eax
	cmpl	%eax, -4056(%rbp)
	jl	.L5
	leaq	-4060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4052(%rbp)
	jmp	.L6
.L7:
	movl	-4052(%rbp), %edx
	movl	-4056(%rbp), %eax
	addl	%edx, %eax
	leaq	-2032(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-4052(%rbp), %ecx
	movl	-4056(%rbp), %eax
	addl	%ecx, %eax
	leaq	-4032(%rbp), %rcx
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4052(%rbp)
.L6:
	movl	-4060(%rbp), %eax
	cmpl	%eax, -4052(%rbp)
	jl	.L7
	movl	$0, -4048(%rbp)
	jmp	.L8
.L12:
	movl	-4048(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4044(%rbp)
	jmp	.L9
.L11:
	movl	-4048(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	movl	%eax, %ebx
	movl	-4044(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4044(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	cmpl	%eax, %ebx
	jle	.L10
	movl	-4048(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	movl	%eax, -4036(%rbp)
	movl	-4044(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	cltq
	movl	%edx, -4032(%rbp,%rax,4)
	movl	-4044(%rbp), %eax
	cltq
	movl	-4036(%rbp), %edx
	movl	%edx, -4032(%rbp,%rax,4)
	movl	-4048(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %eax
	movl	%eax, -4036(%rbp)
	movl	-4044(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	cltq
	movl	%edx, -2032(%rbp,%rax,4)
	movl	-4044(%rbp), %eax
	cltq
	movl	-4036(%rbp), %edx
	movl	%edx, -2032(%rbp,%rax,4)
.L10:
	addl	$1, -4044(%rbp)
.L9:
	movl	-4064(%rbp), %edx
	movl	-4060(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4044(%rbp)
	jl	.L11
	addl	$1, -4048(%rbp)
.L8:
	movl	-4064(%rbp), %edx
	movl	-4060(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4048(%rbp)
	jl	.L12
	movl	$0, -4048(%rbp)
	jmp	.L13
.L17:
	cmpl	$0, -4048(%rbp)
	je	.L14
	movl	-4048(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L14
	movl	-4048(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-2032(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L15
.L14:
	cmpl	$0, -4040(%rbp)
	je	.L16
	movl	$32, %edi
	call	putchar@PLT
.L16:
	addl	$1, -4040(%rbp)
	movl	-4048(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L15:
	addl	$1, -4048(%rbp)
.L13:
	movl	-4064(%rbp), %edx
	movl	-4060(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4048(%rbp)
	jl	.L17
	movl	$10, %edi
	call	putchar@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	calc
	.type	calc, @function
calc:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	imull	$60, %eax, %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d:%02d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$4056, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$0, -4040(%rbp)
	leaq	-4064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4056(%rbp)
	jmp	.L4
.L5:
	leaq	-2032(%rbp), %rdx
	movl	-4056(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-4032(%rbp), %rcx
	movl	-4056(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4056(%rbp)
.L4:
	movl	-4064(%rbp), %eax
	cmpl	%eax, -4056(%rbp)
	jl	.L5
	leaq	-4060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4052(%rbp)
	jmp	.L6
.L7:
	movl	-4052(%rbp), %edx
	movl	-4056(%rbp), %eax
	addl	%edx, %eax
	leaq	-2032(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-4052(%rbp), %ecx
	movl	-4056(%rbp), %eax
	addl	%ecx, %eax
	leaq	-4032(%rbp), %rcx
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4052(%rbp)
.L6:
	movl	-4060(%rbp), %eax
	cmpl	%eax, -4052(%rbp)
	jl	.L7
	movl	$0, -4048(%rbp)
	jmp	.L8
.L12:
	movl	-4048(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4044(%rbp)
	jmp	.L9
.L11:
	movl	-4048(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	movl	%eax, %ebx
	movl	-4044(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4044(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	cmpl	%eax, %ebx
	jle	.L10
	movl	-4048(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	movl	%eax, -4036(%rbp)
	movl	-4044(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	cltq
	movl	%edx, -4032(%rbp,%rax,4)
	movl	-4044(%rbp), %eax
	cltq
	movl	-4036(%rbp), %edx
	movl	%edx, -4032(%rbp,%rax,4)
	movl	-4048(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %eax
	movl	%eax, -4036(%rbp)
	movl	-4044(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	cltq
	movl	%edx, -2032(%rbp,%rax,4)
	movl	-4044(%rbp), %eax
	cltq
	movl	-4036(%rbp), %edx
	movl	%edx, -2032(%rbp,%rax,4)
.L10:
	addl	$1, -4044(%rbp)
.L9:
	movl	-4064(%rbp), %edx
	movl	-4060(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4044(%rbp)
	jl	.L11
	addl	$1, -4048(%rbp)
.L8:
	movl	-4064(%rbp), %edx
	movl	-4060(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4048(%rbp)
	jl	.L12
	movl	$0, -4048(%rbp)
	jmp	.L13
.L17:
	cmpl	$0, -4048(%rbp)
	je	.L14
	movl	-4048(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L14
	movl	-4048(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-2032(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L15
.L14:
	cmpl	$0, -4040(%rbp)
	je	.L16
	movl	$32, %edi
	call	putchar@PLT
.L16:
	addl	$1, -4040(%rbp)
	movl	-4048(%rbp), %eax
	cltq
	movl	-2032(%rbp,%rax,4), %edx
	movl	-4048(%rbp), %eax
	cltq
	movl	-4032(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L15:
	addl	$1, -4048(%rbp)
.L13:
	movl	-4064(%rbp), %edx
	movl	-4060(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -4048(%rbp)
	jl	.L17
	movl	$10, %edi
	call	putchar@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
