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(){
    int A, B, C, K;

    scanf("%d %d %d %d", &A, &B, &C, &K);

    while(K--){
        if (A >= B && A >= C){
            A = A*2;
        } else if (B >= C){
            B = B*2;
        } else {
            C = C*2;
        }
    }

    printf("%d\n", A+B+C);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-12(%rbp), %rsi
	leaq	-16(%rbp), %rcx
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L5:
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	-24(%rbp), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	-24(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -24(%rbp)
	jmp	.L2
.L3:
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L4
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -20(%rbp)
	jmp	.L2
.L4:
	movl	-16(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -16(%rbp)
.L2:
	movl	-12(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -12(%rbp)
	testl	%eax, %eax
	jne	.L5
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	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 %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	.LC0(%rip), %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	16(%rsp), %rcx
	leaq	8(%rsp), %rsi
	leaq	20(%rsp), %r8
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %edx
	leal	-1(%rdx), %eax
	testl	%edx, %edx
	movl	8(%rsp), %edx
	movl	%eax, 20(%rsp)
	je	.L24
	movl	12(%rsp), %ebx
	movl	16(%rsp), %r10d
	movl	%edx, %edi
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	xorl	%r11d, %r11d
	movl	%ebx, %ecx
	movl	%r10d, %esi
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L26:
	cmpl	%esi, %edi
	jl	.L4
	addl	%edi, %edi
	movl	$1, %r11d
.L5:
	subl	$1, %eax
	jb	.L25
.L7:
	cmpl	%ecx, %edi
	jge	.L26
.L4:
	cmpl	%esi, %ecx
	jl	.L6
	addl	%ecx, %ecx
	movl	$1, %r9d
	subl	$1, %eax
	jnb	.L7
.L25:
	movl	$-1, 20(%rsp)
	testb	%r8b, %r8b
	je	.L8
	movl	%esi, 16(%rsp)
	movl	%esi, %r10d
.L8:
	testb	%r9b, %r9b
	je	.L9
	movl	%ecx, 12(%rsp)
	movl	%ecx, %ebx
.L9:
	testb	%r11b, %r11b
	je	.L3
	movl	%edi, 8(%rsp)
	movl	%edi, %edx
.L3:
	addl	%ebx, %edx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	addl	%r10d, %edx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_restore_state
	addl	%esi, %esi
	movl	$1, %r8d
	jmp	.L5
.L24:
	movl	12(%rsp), %ebx
	movl	16(%rsp), %r10d
	jmp	.L3
.L27:
	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 %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	.LC0(%rip), %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	16(%rsp), %rcx
	leaq	8(%rsp), %rsi
	leaq	20(%rsp), %r8
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %edx
	leal	-1(%rdx), %eax
	testl	%edx, %edx
	movl	8(%rsp), %edx
	movl	%eax, 20(%rsp)
	je	.L24
	movl	12(%rsp), %ebx
	movl	16(%rsp), %r10d
	movl	%edx, %edi
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	xorl	%r11d, %r11d
	movl	%ebx, %ecx
	movl	%r10d, %esi
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L26:
	cmpl	%esi, %edi
	jl	.L4
	addl	%edi, %edi
	movl	$1, %r11d
.L5:
	subl	$1, %eax
	jb	.L25
.L7:
	cmpl	%ecx, %edi
	jge	.L26
.L4:
	cmpl	%esi, %ecx
	jl	.L6
	addl	%ecx, %ecx
	movl	$1, %r9d
	subl	$1, %eax
	jnb	.L7
.L25:
	movl	$-1, 20(%rsp)
	testb	%r8b, %r8b
	je	.L8
	movl	%esi, 16(%rsp)
	movl	%esi, %r10d
.L8:
	testb	%r9b, %r9b
	je	.L9
	movl	%ecx, 12(%rsp)
	movl	%ecx, %ebx
.L9:
	testb	%r11b, %r11b
	je	.L3
	movl	%edi, 8(%rsp)
	movl	%edi, %edx
.L3:
	addl	%ebx, %edx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	addl	%r10d, %edx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_restore_state
	addl	%esi, %esi
	movl	$1, %r8d
	jmp	.L5
.L24:
	movl	12(%rsp), %ebx
	movl	16(%rsp), %r10d
	jmp	.L3
.L27:
	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(){
    int A, B, C, K;

    scanf("%d %d %d %d", &A, &B, &C, &K);

    while(K--){
        if (A >= B && A >= C){
            A = A*2;
        } else if (B >= C){
            B = B*2;
        } else {
            C = C*2;
        }
    }

    printf("%d\n", A+B+C);

    return 0;
}
7 3 11
1
 3 3 4
4
 7 5 11
1
 3 3 4
0
 7 5 11
0
 4 3 4
0
 10 5 11
0
 4 3 1
0
 10 5 21
0
 4 1 1
0

32
 70
 34
 10
 23
 11
 26
 8
 36
 6

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(){
    int A, B, C, K;

    scanf("%d %d %d %d", &A, &B, &C, &K);

    while(K--){
        if (A >= B && A >= C){
            A = A*2;
        } else if (B >= C){
            B = B*2;
        } else {
            C = C*2;
        }
    }

    printf("%d\n", A+B+C);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-12(%rbp), %rsi
	leaq	-16(%rbp), %rcx
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L5:
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	-24(%rbp), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	-24(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -24(%rbp)
	jmp	.L2
.L3:
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L4
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -20(%rbp)
	jmp	.L2
.L4:
	movl	-16(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -16(%rbp)
.L2:
	movl	-12(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -12(%rbp)
	testl	%eax, %eax
	jne	.L5
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	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 %d %d %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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-12(%rbp), %rsi
	leaq	-16(%rbp), %rcx
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L5:
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	-24(%rbp), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	-24(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -24(%rbp)
	jmp	.L2
.L3:
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L4
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -20(%rbp)
	jmp	.L2
.L4:
	movl	-16(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -16(%rbp)
.L2:
	movl	-12(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -12(%rbp)
	testl	%eax, %eax
	jne	.L5
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	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:
