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 a[3];
	int i, j, temp = 0, count = 0;

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

	for(i = 0; i < 2; i++){
		for(j = 1; j < 3; j++){
			
			if(a[i] < a[j]){
				temp = a[i];
				a[i] = a[j];
				a[j] = temp;	
			}
		}
	}

	count = a[0] - a[1];
	a[1] = a[0];
	a[2] = a[2] + count;

	while(a[2] < a[0]){
		a[2] = a[2] + 2;
		count++;
	}

	if(a[0] == a[2]){
		printf("%d\n", count);
		return 0;
	}else if(a[2] > a[0]){
		count = count + 1;
		printf("%d\n", count);
		return 0;
	}

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -24(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L2
.L3:
	leaq	-20(%rbp), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -36(%rbp)
.L2:
	cmpl	$2, -36(%rbp)
	jle	.L3
	movl	$0, -36(%rbp)
	jmp	.L4
.L8:
	movl	$1, -32(%rbp)
	jmp	.L5
.L7:
	movl	-36(%rbp), %eax
	cltq
	movl	-20(%rbp,%rax,4), %edx
	movl	-32(%rbp), %eax
	cltq
	movl	-20(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	-36(%rbp), %eax
	cltq
	movl	-20(%rbp,%rax,4), %eax
	movl	%eax, -24(%rbp)
	movl	-32(%rbp), %eax
	cltq
	movl	-20(%rbp,%rax,4), %edx
	movl	-36(%rbp), %eax
	cltq
	movl	%edx, -20(%rbp,%rax,4)
	movl	-32(%rbp), %eax
	cltq
	movl	-24(%rbp), %edx
	movl	%edx, -20(%rbp,%rax,4)
.L6:
	addl	$1, -32(%rbp)
.L5:
	cmpl	$2, -32(%rbp)
	jle	.L7
	addl	$1, -36(%rbp)
.L4:
	cmpl	$1, -36(%rbp)
	jle	.L8
	movl	-20(%rbp), %eax
	movl	-16(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -28(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	jmp	.L9
.L10:
	movl	-12(%rbp), %eax
	addl	$2, %eax
	movl	%eax, -12(%rbp)
	addl	$1, -28(%rbp)
.L9:
	movl	-12(%rbp), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L10
	movl	-20(%rbp), %edx
	movl	-12(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L11
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L14
.L11:
	movl	-12(%rbp), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L13
	addl	$1, -28(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L14
.L13:
	movl	$0, %eax
.L14:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	16(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %edx
	movd	%xmm2, %eax
	pshufd	$225, %xmm0, %xmm1
	cmpl	%edx, %eax
	jle	.L2
	movq	%xmm1, 8(%rsp)
	xchgl	%eax, %edx
.L2:
	movl	16(%rsp), %ecx
	cmpl	%ecx, %edx
	jge	.L3
	movl	12(%rsp), %eax
	movl	%ecx, 8(%rsp)
	movl	%edx, %ecx
	movl	%eax, %esi
.L4:
	cmpl	%ecx, %esi
	movl	8(%rsp), %edi
	cmovl	%ecx, %eax
	cmovl	%esi, %ecx
	movd	%edi, %xmm0
	movl	%edi, %edx
	subl	%eax, %edx
	addl	%edx, %ecx
	movd	%ecx, %xmm3
	punpckldq	%xmm3, %xmm0
	movq	%xmm0, 12(%rsp)
	cmpl	%ecx, %edi
	jle	.L6
	leal	-1(%rdi), %eax
	subl	%ecx, %eax
	movl	%eax, %esi
	andl	$-2, %eax
	leal	2(%rcx,%rax), %ecx
	shrl	%esi
	movl	%ecx, 16(%rsp)
	leal	1(%rsi,%rdx), %edx
.L6:
	cmpl	%ecx, %edi
	je	.L11
	jl	.L13
.L8:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L3:
	.cfi_restore_state
	movl	12(%rsp), %esi
	cmpl	%esi, %eax
	cmovg	%esi, %eax
	jmp	.L4
.L13:
	addl	$1, %edx
.L11:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L14:
	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"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	16(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %edx
	movd	%xmm2, %eax
	pshufd	$225, %xmm0, %xmm1
	cmpl	%edx, %eax
	jle	.L2
	movq	%xmm1, 8(%rsp)
	xchgl	%eax, %edx
.L2:
	movl	16(%rsp), %ecx
	cmpl	%ecx, %edx
	jge	.L3
	movl	12(%rsp), %eax
	movl	%ecx, 8(%rsp)
	movl	%edx, %ecx
	movl	%eax, %esi
.L4:
	cmpl	%ecx, %esi
	movl	8(%rsp), %edi
	cmovl	%ecx, %eax
	cmovl	%esi, %ecx
	movd	%edi, %xmm0
	movl	%edi, %edx
	subl	%eax, %edx
	addl	%edx, %ecx
	movd	%ecx, %xmm3
	punpckldq	%xmm3, %xmm0
	movq	%xmm0, 12(%rsp)
	cmpl	%ecx, %edi
	jle	.L6
	leal	-1(%rdi), %eax
	subl	%ecx, %eax
	movl	%eax, %esi
	andl	$-2, %eax
	leal	2(%rcx,%rax), %ecx
	shrl	%esi
	movl	%ecx, 16(%rsp)
	leal	1(%rsi,%rdx), %edx
.L6:
	cmpl	%ecx, %edi
	je	.L11
	jl	.L13
.L8:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L3:
	.cfi_restore_state
	movl	12(%rsp), %esi
	cmpl	%esi, %eax
	cmovg	%esi, %eax
	jmp	.L4
.L13:
	addl	$1, %edx
.L11:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L14:
	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 a[3];
	int i, j, temp = 0, count = 0;

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

	for(i = 0; i < 2; i++){
		for(j = 1; j < 3; j++){
			
			if(a[i] < a[j]){
				temp = a[i];
				a[i] = a[j];
				a[j] = temp;	
			}
		}
	}

	count = a[0] - a[1];
	a[1] = a[0];
	a[2] = a[2] + count;

	while(a[2] < a[0]){
		a[2] = a[2] + 2;
		count++;
	}

	if(a[0] == a[2]){
		printf("%d\n", count);
		return 0;
	}else if(a[2] > a[0]){
		count = count + 1;
		printf("%d\n", count);
		return 0;
	}

}
2 5 4

2

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 a[3];
	int i, j, temp = 0, count = 0;

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

	for(i = 0; i < 2; i++){
		for(j = 1; j < 3; j++){
			
			if(a[i] < a[j]){
				temp = a[i];
				a[i] = a[j];
				a[j] = temp;	
			}
		}
	}

	count = a[0] - a[1];
	a[1] = a[0];
	a[2] = a[2] + count;

	while(a[2] < a[0]){
		a[2] = a[2] + 2;
		count++;
	}

	if(a[0] == a[2]){
		printf("%d\n", count);
		return 0;
	}else if(a[2] > a[0]){
		count = count + 1;
		printf("%d\n", count);
		return 0;
	}

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -24(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L2
.L3:
	leaq	-20(%rbp), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -36(%rbp)
.L2:
	cmpl	$2, -36(%rbp)
	jle	.L3
	movl	$0, -36(%rbp)
	jmp	.L4
.L8:
	movl	$1, -32(%rbp)
	jmp	.L5
.L7:
	movl	-36(%rbp), %eax
	cltq
	movl	-20(%rbp,%rax,4), %edx
	movl	-32(%rbp), %eax
	cltq
	movl	-20(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	-36(%rbp), %eax
	cltq
	movl	-20(%rbp,%rax,4), %eax
	movl	%eax, -24(%rbp)
	movl	-32(%rbp), %eax
	cltq
	movl	-20(%rbp,%rax,4), %edx
	movl	-36(%rbp), %eax
	cltq
	movl	%edx, -20(%rbp,%rax,4)
	movl	-32(%rbp), %eax
	cltq
	movl	-24(%rbp), %edx
	movl	%edx, -20(%rbp,%rax,4)
.L6:
	addl	$1, -32(%rbp)
.L5:
	cmpl	$2, -32(%rbp)
	jle	.L7
	addl	$1, -36(%rbp)
.L4:
	cmpl	$1, -36(%rbp)
	jle	.L8
	movl	-20(%rbp), %eax
	movl	-16(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -28(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	jmp	.L9
.L10:
	movl	-12(%rbp), %eax
	addl	$2, %eax
	movl	%eax, -12(%rbp)
	addl	$1, -28(%rbp)
.L9:
	movl	-12(%rbp), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L10
	movl	-20(%rbp), %edx
	movl	-12(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L11
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L14
.L11:
	movl	-12(%rbp), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L13
	addl	$1, -28(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L14
.L13:
	movl	$0, %eax
.L14:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -24(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L2
.L3:
	leaq	-20(%rbp), %rdx
	movl	-36(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -36(%rbp)
.L2:
	cmpl	$2, -36(%rbp)
	jle	.L3
	movl	$0, -36(%rbp)
	jmp	.L4
.L8:
	movl	$1, -32(%rbp)
	jmp	.L5
.L7:
	movl	-36(%rbp), %eax
	cltq
	movl	-20(%rbp,%rax,4), %edx
	movl	-32(%rbp), %eax
	cltq
	movl	-20(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	-36(%rbp), %eax
	cltq
	movl	-20(%rbp,%rax,4), %eax
	movl	%eax, -24(%rbp)
	movl	-32(%rbp), %eax
	cltq
	movl	-20(%rbp,%rax,4), %edx
	movl	-36(%rbp), %eax
	cltq
	movl	%edx, -20(%rbp,%rax,4)
	movl	-32(%rbp), %eax
	cltq
	movl	-24(%rbp), %edx
	movl	%edx, -20(%rbp,%rax,4)
.L6:
	addl	$1, -32(%rbp)
.L5:
	cmpl	$2, -32(%rbp)
	jle	.L7
	addl	$1, -36(%rbp)
.L4:
	cmpl	$1, -36(%rbp)
	jle	.L8
	movl	-20(%rbp), %eax
	movl	-16(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -28(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	jmp	.L9
.L10:
	movl	-12(%rbp), %eax
	addl	$2, %eax
	movl	%eax, -12(%rbp)
	addl	$1, -28(%rbp)
.L9:
	movl	-12(%rbp), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L10
	movl	-20(%rbp), %edx
	movl	-12(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L11
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L14
.L11:
	movl	-12(%rbp), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L13
	addl	$1, -28(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L14
.L13:
	movl	$0, %eax
.L14:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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:
