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>

void Sub(int total, int total2, int total3);
int main(void) {
	int a, b, c, x, y, total = 0, total2 = 0, total3 = 0;
	scanf("%d %d %d %d %d", &a, &b, &c, &x, &y);
	total = a * x + b * y;
	total2 = c * 2 * (x > y ? x : y);
	total3 = c * 2 * (x < y ? x : y) + a * (x - (x < y ? x : y)) + b * (y - (x < y ? x : y));
	//printf("%d %d %d\n", total, total2, total3);
	Sub(total, total2, total3);
	return 0;
}

void Sub(int total, int total2, int total3)
{
	int min = total;
	
	if(min>total2) min = total2;
	if(min>total3) min = total3;
	printf("%d\n", min);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %d %d"
	.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, -20(%rbp)
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	-24(%rbp), %rdi
	leaq	-28(%rbp), %rsi
	leaq	-32(%rbp), %rcx
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rdi, %r9
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %ecx
	imull	%eax, %ecx
	movl	-36(%rbp), %edx
	movl	-24(%rbp), %eax
	imull	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movl	-32(%rbp), %eax
	imull	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -16(%rbp)
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movl	-32(%rbp), %eax
	imull	%edx, %eax
	leal	(%rax,%rax), %esi
	movl	-28(%rbp), %ecx
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	-40(%rbp), %eax
	imull	%edx, %eax
	addl	%eax, %esi
	movl	-24(%rbp), %ecx
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	-36(%rbp), %eax
	imull	%edx, %eax
	addl	%esi, %eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %ecx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	Sub
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
.LC1:
	.string	"%d\n"
	.text
	.globl	Sub
	.type	Sub, @function
Sub:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L5
	movl	-24(%rbp), %eax
	movl	%eax, -4(%rbp)
.L5:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L6
	movl	-28(%rbp), %eax
	movl	%eax, -4(%rbp)
.L6:
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	Sub, .-Sub
	.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 %d %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	leaq	20(%rsp), %r9
	leaq	16(%rsp), %r8
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %esi
	movl	16(%rsp), %eax
	movl	12(%rsp), %r10d
	movl	4(%rsp), %ecx
	cmpl	%esi, %eax
	movl	%esi, %r9d
	movl	%eax, %edx
	movl	8(%rsp), %edi
	cmovle	%eax, %r9d
	movl	%r10d, %r8d
	subl	%r9d, %edx
	imull	%r9d, %r8d
	imull	%ecx, %edx
	imull	%eax, %ecx
	leal	(%rdx,%r8,2), %edx
	movl	%esi, %r8d
	subl	%r9d, %r8d
	imull	%edi, %r8d
	imull	%esi, %edi
	addl	%r8d, %edx
	addl	%edi, %ecx
	cmpl	%esi, %eax
	movl	$1, %edi
	cmovl	%esi, %eax
	leaq	.LC1(%rip), %rsi
	imull	%r10d, %eax
	addl	%eax, %eax
	cmpl	%eax, %ecx
	cmovle	%ecx, %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L5
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L5:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	Sub
	.type	Sub, @function
Sub:
.LFB24:
	.cfi_startproc
	endbr64
	cmpl	%edx, %esi
	cmovg	%edx, %esi
	cmpl	%edi, %esi
	cmovle	%esi, %edi
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	movl	%edi, %edx
	movl	$1, %edi
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE24:
	.size	Sub, .-Sub
	.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 %d %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	leaq	20(%rsp), %r9
	leaq	16(%rsp), %r8
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %esi
	movl	16(%rsp), %eax
	movl	12(%rsp), %r10d
	movl	4(%rsp), %ecx
	cmpl	%esi, %eax
	movl	%esi, %r9d
	movl	%eax, %edx
	movl	8(%rsp), %edi
	cmovle	%eax, %r9d
	movl	%r10d, %r8d
	subl	%r9d, %edx
	imull	%r9d, %r8d
	imull	%ecx, %edx
	imull	%eax, %ecx
	leal	(%rdx,%r8,2), %edx
	movl	%esi, %r8d
	subl	%r9d, %r8d
	imull	%edi, %r8d
	imull	%esi, %edi
	addl	%r8d, %edx
	addl	%edi, %ecx
	cmpl	%esi, %eax
	movl	$1, %edi
	cmovl	%esi, %eax
	leaq	.LC1(%rip), %rsi
	imull	%r10d, %eax
	addl	%eax, %eax
	cmpl	%eax, %ecx
	cmovle	%ecx, %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L5
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L5:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	Sub
	.type	Sub, @function
Sub:
.LFB24:
	.cfi_startproc
	endbr64
	cmpl	%edx, %esi
	cmovg	%edx, %esi
	cmpl	%edi, %esi
	cmovle	%esi, %edi
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	movl	%edi, %edx
	movl	$1, %edi
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE24:
	.size	Sub, .-Sub
	.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>

void Sub(int total, int total2, int total3);
int main(void) {
	int a, b, c, x, y, total = 0, total2 = 0, total3 = 0;
	scanf("%d %d %d %d %d", &a, &b, &c, &x, &y);
	total = a * x + b * y;
	total2 = c * 2 * (x > y ? x : y);
	total3 = c * 2 * (x < y ? x : y) + a * (x - (x < y ? x : y)) + b * (y - (x < y ? x : y));
	//printf("%d %d %d\n", total, total2, total3);
	Sub(total, total2, total3);
	return 0;
}

void Sub(int total, int total2, int total3)
{
	int min = total;
	
	if(min>total2) min = total2;
	if(min>total3) min = total3;
	printf("%d\n", min);
}
1500 2000 1600 3 2

7900

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>

void Sub(int total, int total2, int total3);
int main(void) {
	int a, b, c, x, y, total = 0, total2 = 0, total3 = 0;
	scanf("%d %d %d %d %d", &a, &b, &c, &x, &y);
	total = a * x + b * y;
	total2 = c * 2 * (x > y ? x : y);
	total3 = c * 2 * (x < y ? x : y) + a * (x - (x < y ? x : y)) + b * (y - (x < y ? x : y));
	//printf("%d %d %d\n", total, total2, total3);
	Sub(total, total2, total3);
	return 0;
}

void Sub(int total, int total2, int total3)
{
	int min = total;
	
	if(min>total2) min = total2;
	if(min>total3) min = total3;
	printf("%d\n", min);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %d %d"
	.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, -20(%rbp)
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	-24(%rbp), %rdi
	leaq	-28(%rbp), %rsi
	leaq	-32(%rbp), %rcx
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rdi, %r9
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %ecx
	imull	%eax, %ecx
	movl	-36(%rbp), %edx
	movl	-24(%rbp), %eax
	imull	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movl	-32(%rbp), %eax
	imull	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -16(%rbp)
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movl	-32(%rbp), %eax
	imull	%edx, %eax
	leal	(%rax,%rax), %esi
	movl	-28(%rbp), %ecx
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	-40(%rbp), %eax
	imull	%edx, %eax
	addl	%eax, %esi
	movl	-24(%rbp), %ecx
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	-36(%rbp), %eax
	imull	%edx, %eax
	addl	%esi, %eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %ecx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	Sub
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
.LC1:
	.string	"%d\n"
	.text
	.globl	Sub
	.type	Sub, @function
Sub:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L5
	movl	-24(%rbp), %eax
	movl	%eax, -4(%rbp)
.L5:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L6
	movl	-28(%rbp), %eax
	movl	%eax, -4(%rbp)
.L6:
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	Sub, .-Sub
	.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 %d %d %d %d"
	.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, -20(%rbp)
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	-24(%rbp), %rdi
	leaq	-28(%rbp), %rsi
	leaq	-32(%rbp), %rcx
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rdi, %r9
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %ecx
	imull	%eax, %ecx
	movl	-36(%rbp), %edx
	movl	-24(%rbp), %eax
	imull	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movl	-32(%rbp), %eax
	imull	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -16(%rbp)
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movl	-32(%rbp), %eax
	imull	%edx, %eax
	leal	(%rax,%rax), %esi
	movl	-28(%rbp), %ecx
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	-40(%rbp), %eax
	imull	%edx, %eax
	addl	%eax, %esi
	movl	-24(%rbp), %ecx
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	-36(%rbp), %eax
	imull	%edx, %eax
	addl	%esi, %eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %ecx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	Sub
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
.LC1:
	.string	"%d\n"
	.text
	.globl	Sub
	.type	Sub, @function
Sub:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L5
	movl	-24(%rbp), %eax
	movl	%eax, -4(%rbp)
.L5:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L6
	movl	-28(%rbp), %eax
	movl	%eax, -4(%rbp)
.L6:
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	Sub, .-Sub
	.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:
