Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int main(){
    int A, B, C, X, Y;
    int n_a = 0, n_b = 0, n_c = 0;
    int result = 0;
    scanf("%d %d %d %d %d", &A, &B, &C, &X, &Y);
    if((A + B) > 2 * C){
        if(X > Y){
            n_c += 2 * Y;
            X -= Y; Y = 0;
        }else{
            n_c += 2 * X;
            Y -= X; X = 0;
        }
    }
    if(X > 0){
        if(A > 2 * C){
            n_c += 2 * X;
        }else{
            n_a += X;
        }
        X = 0;
    }
    if(Y > 0){
        if (B > 2 * C){
            n_c += 2 * Y;
        }else{
            n_b += Y;
        }
        Y = 0;
    }
    printf("%d\n", A * n_a + B * n_b + C * n_c);
    return 0;
}
```

Assembly Code:

```assembly
	.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	4(%rsp), %edx
	movl	8(%rsp), %eax
	movl	12(%rsp), %ecx
	leal	(%rdx,%rax), %esi
	leal	(%rcx,%rcx), %r9d
	cmpl	%r9d, %esi
	movl	16(%rsp), %esi
	jle	.L2
	movl	20(%rsp), %edi
	cmpl	%edi, %esi
	jle	.L3
	movl	$0, 20(%rsp)
	leal	(%rdi,%rdi), %r8d
	subl	%edi, %esi
.L4:
	cmpl	%r9d, %edx
	jg	.L14
.L6:
	movl	$0, 16(%rsp)
.L5:
	movl	20(%rsp), %edi
	testl	%edi, %edi
	jle	.L11
	cmpl	%r9d, %eax
	jg	.L15
.L8:
	movl	$0, 20(%rsp)
.L7:
	imull	%edi, %eax
	movl	$1, %edi
	imull	%esi, %edx
	leaq	.LC1(%rip), %rsi
	imull	%r8d, %ecx
	addl	%eax, %edx
	xorl	%eax, %eax
	addl	%ecx, %edx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	xorl	%r8d, %r8d
	testl	%esi, %esi
	jg	.L4
	xorl	%esi, %esi
	jmp	.L5
.L15:
	leal	(%r8,%rdi,2), %r8d
	xorl	%edi, %edi
	jmp	.L8
.L14:
	leal	(%r8,%rsi,2), %r8d
	xorl	%esi, %esi
	jmp	.L6
.L3:
	subl	%esi, %edi
	leal	(%rsi,%rsi), %r8d
	movl	$0, 16(%rsp)
	xorl	%esi, %esi
	movl	%edi, 20(%rsp)
	jmp	.L5
.L11:
	xorl	%edi, %edi
	jmp	.L7
.L16:
	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:
```

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.
Optimized Assembly Code:

user
```assembly
	.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	4(%rsp), %edx
	movl	8(%rsp), %eax
	movl	12(%rsp), %ecx
	leal	(%rdx,%rax), %esi
	leal	(%rcx,%rcx), %r9d
	cmpl	%r9d, %esi
	movl	16(%rsp), %esi
	jle	.L2
	movl	20(%rsp), %edi
	cmpl	%edi, %esi
	jle	.L3
	movl	$0, 20(%rsp)
	leal	(%rdi,%rdi), %r8d
	subl	%edi, %esi
.L4:
	cmpl	%r9d, %edx
	jg	.L14
.L6:
	movl	$0, 16(%rsp)
.L5:
	movl	20(%rsp), %edi
	testl	%edi, %edi
	jle	.L11
	cmpl	%r9d, %eax
	jg	.L15
.L8:
	movl	$0, 20(%rsp)
.L7:
	imull	%edi, %eax
	movl	$1, %edi
	imull	%esi, %edx
	leaq	.LC1(%rip), %rsi
	imull	%r8d, %ecx
	addl	%eax, %edx
	xorl	%eax, %eax
	addl	%ecx, %edx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	xorl	%r8d, %r8d
	testl	%esi, %esi
	jg	.L4
	xorl	%esi, %esi
	jmp	.L5
.L15:
	leal	(%r8,%rdi,2), %r8d
	xorl	%edi, %edi
	jmp	.L8
.L14:
	leal	(%r8,%rsi,2), %r8d
	xorl	%esi, %esi
	jmp	.L6
.L3:
	subl	%esi, %edi
	leal	(%rsi,%rsi), %r8d
	movl	$0, 16(%rsp)
	xorl	%esi, %esi
	movl	%edi, 20(%rsp)
	jmp	.L5
.L11:
	xorl	%edi, %edi
	jmp	.L7
.L16:
	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
```assembly
	.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	4(%rsp), %edx
	movl	8(%rsp), %eax
	movl	12(%rsp), %ecx
	leal	(%rdx,%rax), %esi
	leal	(%rcx,%rcx), %r9d
	cmpl	%r9d, %esi
	movl	16(%rsp), %esi
	jle	.L2
	movl	20(%rsp), %edi
	cmpl	%edi, %esi
	jle	.L3
	movl	$0, 20(%rsp)
	leal	(%rdi,%rdi), %r8d
	subl	%edi, %esi
.L4:
	cmpl	%r9d, %edx
	jg	.L14
.L6:
	movl	$0, 16(%rsp)
.L5:
	movl	20(%rsp), %edi
	testl	%edi, %edi
	jle	.L11
	cmpl	%r9d, %eax
	jg	.L15
.L8:
	movl	$0, 20(%rsp)
.L7:
	imull	%edi, %eax
	movl	$1, %edi
	imull	%esi, %edx
	leaq	.LC1(%rip), %rsi
	imull	%r8d, %ecx
	addl	%eax, %edx
	xorl	%eax, %eax
	addl	%ecx, %edx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	xorl	%r8d, %r8d
	testl	%esi, %esi
	jg	.L4
	xorl	%esi, %esi
	jmp	.L5
.L15:
	leal	(%r8,%rdi,2), %r8d
	xorl	%edi, %edi
	jmp	.L8
.L14:
	leal	(%r8,%rsi,2), %r8d
	xorl	%esi, %esi
	jmp	.L6
.L3:
	subl	%esi, %edi
	leal	(%rsi,%rsi), %r8d
	movl	$0, 16(%rsp)
	xorl	%esi, %esi
	movl	%edi, 20(%rsp)
	jmp	.L5
.L11:
	xorl	%edi, %edi
	jmp	.L7
.L16:
	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:
```
```c
#include <stdio.h>

int main(){
    int A, B, C, X, Y;
    int n_a = 0, n_b = 0, n_c = 0;
    int result = 0;
    scanf("%d %d %d %d %d", &A, &B, &C, &X, &Y);
    if((A + B) > 2 * C){
        if(X > Y){
            n_c += 2 * Y;
            X -= Y; Y = 0;
        }else{
            n_c += 2 * X;
            Y -= X; X = 0;
        }
    }
    if(X > 0){
        if(A > 2 * C){
            n_c += 2 * X;
        }else{
            n_a += X;
        }
        X = 0;
    }
    if(Y > 0){
        if (B > 2 * C){
            n_c += 2 * Y;
        }else{
            n_b += Y;
        }
        Y = 0;
    }
    printf("%d\n", A * n_a + B * n_b + C * n_c);
    return 0;
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int main(){
    int A, B, C, X, Y;
    int n_a = 0, n_b = 0, n_c = 0;
    int result = 0;
    scanf("%d %d %d %d %d", &A, &B, &C, &X, &Y);
    if((A + B) > 2 * C){
        if(X > Y){
            n_c += 2 * Y;
            X -= Y; Y = 0;
        }else{
            n_c += 2 * X;
            Y -= X; X = 0;
        }
    }
    if(X > 0){
        if(A > 2 * C){
            n_c += 2 * X;
        }else{
            n_a += X;
        }
        X = 0;
    }
    if(Y > 0){
        if (B > 2 * C){
            n_c += 2 * Y;
        }else{
            n_b += Y;
        }
        Y = 0;
    }
    printf("%d\n", A * n_a + B * n_b + C * n_c);
    return 0;
}
```

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.
Optimized Assembly Code:

1500 2000 1600 3 2

7900

Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int main(){
    int A, B, C, X, Y;
    int n_a = 0, n_b = 0, n_c = 0;
    int result = 0;
    scanf("%d %d %d %d %d", &A, &B, &C, &X, &Y);
    if((A + B) > 2 * C){
        if(X > Y){
            n_c += 2 * Y;
            X -= Y; Y = 0;
        }else{
            n_c += 2 * X;
            Y -= X; X = 0;
        }
    }
    if(X > 0){
        if(A > 2 * C){
            n_c += 2 * X;
        }else{
            n_a += X;
        }
        X = 0;
    }
    if(Y > 0){
        if (B > 2 * C){
            n_c += 2 * Y;
        }else{
            n_b += Y;
        }
        Y = 0;
    }
    printf("%d\n", A * n_a + B * n_b + C * n_c);
    return 0;
}
```

Assembly Code:

```assembly
	.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	4(%rsp), %edx
	movl	8(%rsp), %eax
	movl	12(%rsp), %ecx
	leal	(%rdx,%rax), %esi
	leal	(%rcx,%rcx), %r9d
	cmpl	%r9d, %esi
	movl	16(%rsp), %esi
	jle	.L2
	movl	20(%rsp), %edi
	cmpl	%edi, %esi
	jle	.L3
	movl	$0, 20(%rsp)
	leal	(%rdi,%rdi), %r8d
	subl	%edi, %esi
.L4:
	cmpl	%r9d, %edx
	jg	.L14
.L6:
	movl	$0, 16(%rsp)
.L5:
	movl	20(%rsp), %edi
	testl	%edi, %edi
	jle	.L11
	cmpl	%r9d, %eax
	jg	.L15
.L8:
	movl	$0, 20(%rsp)
.L7:
	imull	%edi, %eax
	movl	$1, %edi
	imull	%esi, %edx
	leaq	.LC1(%rip), %rsi
	imull	%r8d, %ecx
	addl	%eax, %edx
	xorl	%eax, %eax
	addl	%ecx, %edx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	xorl	%r8d, %r8d
	testl	%esi, %esi
	jg	.L4
	xorl	%esi, %esi
	jmp	.L5
.L15:
	leal	(%r8,%rdi,2), %r8d
	xorl	%edi, %edi
	jmp	.L8
.L14:
	leal	(%r8,%rsi,2), %r8d
	xorl	%esi, %esi
	jmp	.L6
.L3:
	subl	%esi, %edi
	leal	(%rsi,%rsi), %r8d
	movl	$0, 16(%rsp)
	xorl	%esi, %esi
	movl	%edi, 20(%rsp)
	jmp	.L5
.L11:
	xorl	%edi, %edi
	jmp	.L7
.L16:
	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:
```

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.
Optimized Assembly Code:

train
```assembly
	.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	4(%rsp), %edx
	movl	8(%rsp), %eax
	movl	12(%rsp), %ecx
	leal	(%rdx,%rax), %esi
	leal	(%rcx,%rcx), %r9d
	cmpl	%r9d, %esi
	movl	16(%rsp), %esi
	jle	.L2
	movl	20(%rsp), %edi
	cmpl	%edi, %esi
	jle	.L3
	movl	$0, 20(%rsp)
	leal	(%rdi,%rdi), %r8d
	subl	%edi, %esi
.L4:
	cmpl	%r9d, %edx
	jg	.L14
.L6:
	movl	$0, 16(%rsp)
.L5:
	movl	20(%rsp), %edi
	testl	%edi, %edi
	jle	.L11
	cmpl	%r9d, %eax
	jg	.L15
.L8:
	movl	$0, 20(%rsp)
.L7:
	imull	%edi, %eax
	movl	$1, %edi
	imull	%esi, %edx
	leaq	.LC1(%rip), %rsi
	imull	%r8d, %ecx
	addl	%eax, %edx
	xorl	%eax, %eax
	addl	%ecx, %edx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	xorl	%r8d, %r8d
	testl	%esi, %esi
	jg	.L4
	xorl	%esi, %esi
	jmp	.L5
.L15:
	leal	(%r8,%rdi,2), %r8d
	xorl	%edi, %edi
	jmp	.L8
.L14:
	leal	(%r8,%rsi,2), %r8d
	xorl	%esi, %esi
	jmp	.L6
.L3:
	subl	%esi, %edi
	leal	(%rsi,%rsi), %r8d
	movl	$0, 16(%rsp)
	xorl	%esi, %esi
	movl	%edi, 20(%rsp)
	jmp	.L5
.L11:
	xorl	%edi, %edi
	jmp	.L7
.L16:
	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:
```