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>
#include<string.h>
int main()
{
    int unant,ant,poi,count=0,flag=0;
    scanf("%d %d %d",&unant,&ant,&poi);
    while(poi>0 &&ant>0)
    {
        poi--;
        count++;
        ant--;
        count++;
    }
    if(poi>0)
    {
        while(poi>0&&unant>0)
        {
            poi--;
            unant--;
            count++;
        }
        if(poi>0) printf("%d",++count);
        else printf("%d",count);
    }
    else if(ant>0)
    {
        while(ant>0)
        {
            ant--;
            count++;
        }
    printf("%d",count);
    }
    else if(poi==0&&ant==0)printf("%d",count);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	-20(%rbp), %rcx
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L4:
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	addl	$1, -16(%rbp)
	movl	-24(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	addl	$1, -16(%rbp)
.L2:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L3
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jg	.L4
.L3:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L5
	jmp	.L6
.L8:
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	addl	$1, -16(%rbp)
.L6:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L7
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	jg	.L8
.L7:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L9
	addl	$1, -16(%rbp)
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L9:
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L5:
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jle	.L11
	jmp	.L12
.L13:
	movl	-24(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	addl	$1, -16(%rbp)
.L12:
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jg	.L13
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L11:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L10:
	movl	$0, %eax
	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 %d %d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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	20(%rsp), %rcx
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L17
	movl	16(%rsp), %eax
	leal	-1(%rcx), %esi
	movl	%ecx, %r9d
	leal	(%rcx,%rcx), %r8d
	xorl	%edi, %edi
	xorl	%edx, %edx
	subl	%eax, %esi
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L5:
	addl	$2, %edx
	leal	(%rsi,%rax), %ecx
	movl	$1, %edi
	subl	$1, %eax
	cmpl	%r8d, %edx
	je	.L4
.L3:
	testl	%eax, %eax
	jg	.L5
	testb	%dil, %dil
	je	.L6
	movl	%ecx, 20(%rsp)
	movl	%ecx, %r9d
	movl	%eax, 16(%rsp)
.L6:
	testl	%r9d, %r9d
	jle	.L28
	movl	12(%rsp), %eax
	leal	-1(%r9), %ecx
	xorl	%esi, %esi
	movl	%eax, %r8d
	leal	1(%rdx,%rax), %edi
	subl	%eax, %ecx
	subl	%r9d, %r8d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L10:
	leal	(%rcx,%rax), %ebx
	subl	$1, %eax
	movl	$1, %esi
	cmpl	%r8d, %eax
	je	.L9
.L8:
	movl	%edi, %edx
	subl	%eax, %edx
	testl	%eax, %eax
	jg	.L10
	testb	%sil, %sil
	je	.L28
.L9:
	movl	%eax, 12(%rsp)
	movl	%ebx, 20(%rsp)
.L28:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L12:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L4:
	.cfi_restore_state
	movl	%ecx, 20(%rsp)
	movl	%eax, 16(%rsp)
.L2:
	movl	16(%rsp), %eax
	testl	%eax, %eax
	jle	.L31
	addl	%eax, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	movl	$0, 16(%rsp)
	call	__printf_chk@PLT
	jmp	.L12
.L31:
	orl	%ecx, %eax
	jne	.L12
	jmp	.L28
.L17:
	xorl	%edx, %edx
	jmp	.L2
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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	20(%rsp), %rcx
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L17
	movl	16(%rsp), %eax
	leal	-1(%rcx), %esi
	movl	%ecx, %r9d
	leal	(%rcx,%rcx), %r8d
	xorl	%edi, %edi
	xorl	%edx, %edx
	subl	%eax, %esi
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L5:
	addl	$2, %edx
	leal	(%rsi,%rax), %ecx
	movl	$1, %edi
	subl	$1, %eax
	cmpl	%r8d, %edx
	je	.L4
.L3:
	testl	%eax, %eax
	jg	.L5
	testb	%dil, %dil
	je	.L6
	movl	%ecx, 20(%rsp)
	movl	%ecx, %r9d
	movl	%eax, 16(%rsp)
.L6:
	testl	%r9d, %r9d
	jle	.L28
	movl	12(%rsp), %eax
	leal	-1(%r9), %ecx
	xorl	%esi, %esi
	movl	%eax, %r8d
	leal	1(%rdx,%rax), %edi
	subl	%eax, %ecx
	subl	%r9d, %r8d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L10:
	leal	(%rcx,%rax), %ebx
	subl	$1, %eax
	movl	$1, %esi
	cmpl	%r8d, %eax
	je	.L9
.L8:
	movl	%edi, %edx
	subl	%eax, %edx
	testl	%eax, %eax
	jg	.L10
	testb	%sil, %sil
	je	.L28
.L9:
	movl	%eax, 12(%rsp)
	movl	%ebx, 20(%rsp)
.L28:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L12:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L4:
	.cfi_restore_state
	movl	%ecx, 20(%rsp)
	movl	%eax, 16(%rsp)
.L2:
	movl	16(%rsp), %eax
	testl	%eax, %eax
	jle	.L31
	addl	%eax, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	movl	$0, 16(%rsp)
	call	__printf_chk@PLT
	jmp	.L12
.L31:
	orl	%ecx, %eax
	jne	.L12
	jmp	.L28
.L17:
	xorl	%edx, %edx
	jmp	.L2
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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>
#include<string.h>
int main()
{
    int unant,ant,poi,count=0,flag=0;
    scanf("%d %d %d",&unant,&ant,&poi);
    while(poi>0 &&ant>0)
    {
        poi--;
        count++;
        ant--;
        count++;
    }
    if(poi>0)
    {
        while(poi>0&&unant>0)
        {
            poi--;
            unant--;
            count++;
        }
        if(poi>0) printf("%d",++count);
        else printf("%d",count);
    }
    else if(ant>0)
    {
        while(ant>0)
        {
            ant--;
            count++;
        }
    printf("%d",count);
    }
    else if(poi==0&&ant==0)printf("%d",count);
}

0 1 4
 14 8 1
 9 2 9
 0 0 4
 14 8 2
 3 2 9
 11 15 2
 11 15 4
 3 0 12
 0 2 0

3 9 11 1 10 8 17 19 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>
#include<string.h>
int main()
{
    int unant,ant,poi,count=0,flag=0;
    scanf("%d %d %d",&unant,&ant,&poi);
    while(poi>0 &&ant>0)
    {
        poi--;
        count++;
        ant--;
        count++;
    }
    if(poi>0)
    {
        while(poi>0&&unant>0)
        {
            poi--;
            unant--;
            count++;
        }
        if(poi>0) printf("%d",++count);
        else printf("%d",count);
    }
    else if(ant>0)
    {
        while(ant>0)
        {
            ant--;
            count++;
        }
    printf("%d",count);
    }
    else if(poi==0&&ant==0)printf("%d",count);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	-20(%rbp), %rcx
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L4:
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	addl	$1, -16(%rbp)
	movl	-24(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	addl	$1, -16(%rbp)
.L2:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L3
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jg	.L4
.L3:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L5
	jmp	.L6
.L8:
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	addl	$1, -16(%rbp)
.L6:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L7
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	jg	.L8
.L7:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L9
	addl	$1, -16(%rbp)
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L9:
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L5:
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jle	.L11
	jmp	.L12
.L13:
	movl	-24(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	addl	$1, -16(%rbp)
.L12:
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jg	.L13
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L11:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L10:
	movl	$0, %eax
	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 %d %d"
.LC1:
	.string	"%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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	-20(%rbp), %rcx
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L4:
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	addl	$1, -16(%rbp)
	movl	-24(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	addl	$1, -16(%rbp)
.L2:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L3
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jg	.L4
.L3:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L5
	jmp	.L6
.L8:
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	addl	$1, -16(%rbp)
.L6:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L7
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	jg	.L8
.L7:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L9
	addl	$1, -16(%rbp)
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L9:
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L5:
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jle	.L11
	jmp	.L12
.L13:
	movl	-24(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	addl	$1, -16(%rbp)
.L12:
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jg	.L13
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L11:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L10:
	movl	$0, %eax
	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:
