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 i,j;
	int a[5];
	int rock, scissors, paper;

	while(1){
		
		rock=0; scissors=0; paper=0;
		for(i=0; i<5; i++){
			scanf("%d",&a[i]);
			if(a[i] == 0)
				break;
			if(a[i] == 1){
				rock++;
			}else if(a[i] == 2){
				scissors++;
			}else if(a[i] == 3){
				paper++;
			}
		}
		if(i<5)
			break;

		
		if((rock>0 && scissors>0 && paper>0) || rock == 5 || scissors == 5 || paper == 5){
			for(j=0; j<5; j++)
				printf("3\n");
		}else if(rock>0 && scissors>0){
			for(j=0; j<5; j++)
				if(a[j] == 1) printf("1\n");
				else if(a[j] == 2) printf("2\n");
		}else if(rock>0 && paper>0){
			for(j=0; j<5; j++)
				if(a[j] == 3) printf("1\n");
				else if(a[j] == 1) printf("2\n");
		}else if(scissors>0 && paper>0){
			for(j=0; j<5; j++)
				if(a[j] == 2) printf("1\n");
				else if(a[j] == 3) printf("2\n");
			}

	}
	
	
	return 0;

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"3"
.LC2:
	.string	"1"
.LC3:
	.string	"2"
	.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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L31:
	movl	$0, -44(%rbp)
	movl	$0, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -52(%rbp)
	jmp	.L2
.L8:
	leaq	-32(%rbp), %rdx
	movl	-52(%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
	movl	-52(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L35
	movl	-52(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L5
	addl	$1, -44(%rbp)
	jmp	.L6
.L5:
	movl	-52(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jne	.L7
	addl	$1, -40(%rbp)
	jmp	.L6
.L7:
	movl	-52(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$3, %eax
	jne	.L6
	addl	$1, -36(%rbp)
.L6:
	addl	$1, -52(%rbp)
.L2:
	cmpl	$4, -52(%rbp)
	jle	.L8
	jmp	.L4
.L35:
	nop
.L4:
	cmpl	$4, -52(%rbp)
	jle	.L36
	cmpl	$0, -44(%rbp)
	jle	.L11
	cmpl	$0, -40(%rbp)
	jle	.L11
	cmpl	$0, -36(%rbp)
	jg	.L12
.L11:
	cmpl	$5, -44(%rbp)
	je	.L12
	cmpl	$5, -40(%rbp)
	je	.L12
	cmpl	$5, -36(%rbp)
	jne	.L13
.L12:
	movl	$0, -48(%rbp)
	jmp	.L14
.L15:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -48(%rbp)
.L14:
	cmpl	$4, -48(%rbp)
	jle	.L15
	jmp	.L16
.L13:
	cmpl	$0, -44(%rbp)
	jle	.L17
	cmpl	$0, -40(%rbp)
	jle	.L17
	movl	$0, -48(%rbp)
	jmp	.L18
.L21:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L19
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L20
.L19:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jne	.L20
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L20:
	addl	$1, -48(%rbp)
.L18:
	cmpl	$4, -48(%rbp)
	jle	.L21
	jmp	.L16
.L17:
	cmpl	$0, -44(%rbp)
	jle	.L22
	cmpl	$0, -36(%rbp)
	jle	.L22
	movl	$0, -48(%rbp)
	jmp	.L23
.L26:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$3, %eax
	jne	.L24
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L25
.L24:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L25
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L25:
	addl	$1, -48(%rbp)
.L23:
	cmpl	$4, -48(%rbp)
	jle	.L26
	jmp	.L16
.L22:
	cmpl	$0, -40(%rbp)
	jle	.L31
	cmpl	$0, -36(%rbp)
	jle	.L31
	movl	$0, -48(%rbp)
	jmp	.L27
.L30:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jne	.L28
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L29
.L28:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$3, %eax
	jne	.L29
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L29:
	addl	$1, -48(%rbp)
.L27:
	cmpl	$4, -48(%rbp)
	jle	.L30
.L16:
	jmp	.L31
.L36:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	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	"3"
.LC2:
	.string	"2"
.LC3:
	.string	"1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %r14
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	xorl	%ebp, %ebp
.L7:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%r14), %eax
	testl	%eax, %eax
	je	.L3
	cmpl	$1, %eax
	je	.L83
	cmpl	$2, %eax
	je	.L84
	cmpl	$3, %eax
	sete	%al
	movzbl	%al, %eax
	addl	%eax, %ebx
.L5:
	addq	$4, %r14
	cmpq	(%rsp), %r14
	jne	.L7
	testl	%ebp, %ebp
	setg	%dl
	testl	%r12d, %r12d
	setg	%cl
	movl	%edx, %esi
	andl	%ecx, %esi
	testl	%ebx, %ebx
	je	.L44
	testb	%sil, %sil
	jne	.L46
.L44:
	cmpl	$5, %ebp
	sete	%al
	cmpl	$5, %r12d
	sete	%dil
	orb	%dil, %al
	jne	.L46
	cmpl	$5, %ebx
	je	.L46
	testb	%sil, %sil
	jne	.L85
	testl	%ebx, %ebx
	setg	%al
	testb	%dl, %dl
	je	.L24
	testb	%al, %al
	jne	.L86
.L24:
	testb	%cl, %cl
	je	.L2
	testb	%al, %al
	je	.L2
	movl	16(%rsp), %eax
	cmpl	$2, %eax
	je	.L34
	cmpl	$3, %eax
	je	.L87
.L35:
	movl	20(%rsp), %eax
	cmpl	$2, %eax
	je	.L36
	cmpl	$3, %eax
	je	.L88
.L37:
	movl	24(%rsp), %eax
	cmpl	$2, %eax
	je	.L38
	cmpl	$3, %eax
	je	.L89
.L39:
	movl	28(%rsp), %eax
	cmpl	$2, %eax
	je	.L40
	cmpl	$3, %eax
	je	.L90
.L41:
	movl	32(%rsp), %eax
	cmpl	$2, %eax
	je	.L22
	cmpl	$3, %eax
	jne	.L2
.L33:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L83:
	addl	$1, %ebp
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L84:
	addl	$1, %r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L46:
	movl	$5, %ebx
.L11:
	movq	%r15, %rdi
	call	puts@PLT
	subl	$1, %ebx
	jne	.L11
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L85:
	movl	16(%rsp), %eax
	cmpl	$1, %eax
	je	.L14
	cmpl	$2, %eax
	je	.L91
.L15:
	movl	20(%rsp), %eax
	cmpl	$1, %eax
	je	.L16
	cmpl	$2, %eax
	je	.L92
.L17:
	movl	24(%rsp), %eax
	cmpl	$1, %eax
	je	.L18
	cmpl	$2, %eax
	je	.L93
.L19:
	movl	28(%rsp), %eax
	cmpl	$1, %eax
	je	.L20
	cmpl	$2, %eax
	je	.L94
.L21:
	movl	32(%rsp), %eax
	cmpl	$1, %eax
	je	.L22
	cmpl	$2, %eax
	jne	.L2
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L3:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L95
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L86:
	.cfi_restore_state
	movl	16(%rsp), %eax
	cmpl	$3, %eax
	je	.L25
	subl	$1, %eax
	je	.L96
.L26:
	movl	20(%rsp), %eax
	cmpl	$3, %eax
	je	.L27
	subl	$1, %eax
	je	.L97
.L28:
	movl	24(%rsp), %eax
	cmpl	$3, %eax
	je	.L29
	subl	$1, %eax
	je	.L98
.L30:
	movl	28(%rsp), %eax
	cmpl	$3, %eax
	je	.L31
	subl	$1, %eax
	je	.L99
.L32:
	movl	32(%rsp), %eax
	cmpl	$3, %eax
	je	.L22
	subl	$1, %eax
	jne	.L2
	jmp	.L33
.L22:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L2
.L20:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L21
.L18:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L19
.L16:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L17
.L14:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L15
.L34:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L35
.L92:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L17
.L93:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L19
.L94:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L21
.L91:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L15
.L27:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L28
.L29:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L30
.L25:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L26
.L31:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L32
.L98:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L30
.L96:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L26
.L99:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L32
.L97:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L28
.L40:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L41
.L38:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L39
.L36:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L37
.L88:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L37
.L90:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L41
.L89:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L39
.L87:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L35
.L95:
	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	"3"
.LC2:
	.string	"2"
.LC3:
	.string	"1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %r14
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	xorl	%ebp, %ebp
.L7:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%r14), %eax
	testl	%eax, %eax
	je	.L3
	cmpl	$1, %eax
	je	.L83
	cmpl	$2, %eax
	je	.L84
	cmpl	$3, %eax
	sete	%al
	movzbl	%al, %eax
	addl	%eax, %ebx
.L5:
	addq	$4, %r14
	cmpq	(%rsp), %r14
	jne	.L7
	testl	%ebp, %ebp
	setg	%dl
	testl	%r12d, %r12d
	setg	%cl
	movl	%edx, %esi
	andl	%ecx, %esi
	testl	%ebx, %ebx
	je	.L44
	testb	%sil, %sil
	jne	.L46
.L44:
	cmpl	$5, %ebp
	sete	%al
	cmpl	$5, %r12d
	sete	%dil
	orb	%dil, %al
	jne	.L46
	cmpl	$5, %ebx
	je	.L46
	testb	%sil, %sil
	jne	.L85
	testl	%ebx, %ebx
	setg	%al
	testb	%dl, %dl
	je	.L24
	testb	%al, %al
	jne	.L86
.L24:
	testb	%cl, %cl
	je	.L2
	testb	%al, %al
	je	.L2
	movl	16(%rsp), %eax
	cmpl	$2, %eax
	je	.L34
	cmpl	$3, %eax
	je	.L87
.L35:
	movl	20(%rsp), %eax
	cmpl	$2, %eax
	je	.L36
	cmpl	$3, %eax
	je	.L88
.L37:
	movl	24(%rsp), %eax
	cmpl	$2, %eax
	je	.L38
	cmpl	$3, %eax
	je	.L89
.L39:
	movl	28(%rsp), %eax
	cmpl	$2, %eax
	je	.L40
	cmpl	$3, %eax
	je	.L90
.L41:
	movl	32(%rsp), %eax
	cmpl	$2, %eax
	je	.L22
	cmpl	$3, %eax
	jne	.L2
.L33:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L83:
	addl	$1, %ebp
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L84:
	addl	$1, %r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L46:
	movl	$5, %ebx
.L11:
	movq	%r15, %rdi
	call	puts@PLT
	subl	$1, %ebx
	jne	.L11
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L85:
	movl	16(%rsp), %eax
	cmpl	$1, %eax
	je	.L14
	cmpl	$2, %eax
	je	.L91
.L15:
	movl	20(%rsp), %eax
	cmpl	$1, %eax
	je	.L16
	cmpl	$2, %eax
	je	.L92
.L17:
	movl	24(%rsp), %eax
	cmpl	$1, %eax
	je	.L18
	cmpl	$2, %eax
	je	.L93
.L19:
	movl	28(%rsp), %eax
	cmpl	$1, %eax
	je	.L20
	cmpl	$2, %eax
	je	.L94
.L21:
	movl	32(%rsp), %eax
	cmpl	$1, %eax
	je	.L22
	cmpl	$2, %eax
	jne	.L2
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L3:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L95
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L86:
	.cfi_restore_state
	movl	16(%rsp), %eax
	cmpl	$3, %eax
	je	.L25
	subl	$1, %eax
	je	.L96
.L26:
	movl	20(%rsp), %eax
	cmpl	$3, %eax
	je	.L27
	subl	$1, %eax
	je	.L97
.L28:
	movl	24(%rsp), %eax
	cmpl	$3, %eax
	je	.L29
	subl	$1, %eax
	je	.L98
.L30:
	movl	28(%rsp), %eax
	cmpl	$3, %eax
	je	.L31
	subl	$1, %eax
	je	.L99
.L32:
	movl	32(%rsp), %eax
	cmpl	$3, %eax
	je	.L22
	subl	$1, %eax
	jne	.L2
	jmp	.L33
.L22:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L2
.L20:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L21
.L18:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L19
.L16:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L17
.L14:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L15
.L34:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L35
.L92:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L17
.L93:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L19
.L94:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L21
.L91:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L15
.L27:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L28
.L29:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L30
.L25:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L26
.L31:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L32
.L98:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L30
.L96:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L26
.L99:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L32
.L97:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L28
.L40:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L41
.L38:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L39
.L36:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L37
.L88:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L37
.L90:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L41
.L89:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L39
.L87:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L35
.L95:
	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 i,j;
	int a[5];
	int rock, scissors, paper;

	while(1){
		
		rock=0; scissors=0; paper=0;
		for(i=0; i<5; i++){
			scanf("%d",&a[i]);
			if(a[i] == 0)
				break;
			if(a[i] == 1){
				rock++;
			}else if(a[i] == 2){
				scissors++;
			}else if(a[i] == 3){
				paper++;
			}
		}
		if(i<5)
			break;

		
		if((rock>0 && scissors>0 && paper>0) || rock == 5 || scissors == 5 || paper == 5){
			for(j=0; j<5; j++)
				printf("3\n");
		}else if(rock>0 && scissors>0){
			for(j=0; j<5; j++)
				if(a[j] == 1) printf("1\n");
				else if(a[j] == 2) printf("2\n");
		}else if(rock>0 && paper>0){
			for(j=0; j<5; j++)
				if(a[j] == 3) printf("1\n");
				else if(a[j] == 1) printf("2\n");
		}else if(scissors>0 && paper>0){
			for(j=0; j<5; j++)
				if(a[j] == 2) printf("1\n");
				else if(a[j] == 3) printf("2\n");
			}

	}
	
	
	return 0;

}
1
3
3
2
1
1
2
2
2
1
0
 1
1
1
2
1
1
2
2
2
1
0
 1
2
3
2
1
1
1
2
2
1
0
 1
2
2
2
1
1
1
2
2
1
0
 1
2
3
2
1
1
2
2
2
2
0
 1
3
1
2
1
1
2
1
2
1
0
 1
2
3
2
1
1
2
3
2
2
0
 1
2
2
2
1
1
2
3
2
2
0
 1
1
2
2
1
1
2
3
2
2
0
 1
3
3
1
1
1
2
3
2
2
0

3
3
3
3
3
1
2
2
2
1
 1
1
1
2
1
1
2
2
2
1
 3
3
3
3
3
1
1
2
2
1
 1
2
2
2
1
1
1
2
2
1
 3
3
3
3
3
1
2
2
2
2
 3
3
3
3
3
1
2
1
2
1
 3
3
3
3
3
3
3
3
3
3
 1
2
2
2
1
3
3
3
3
3
 1
1
2
2
1
3
3
3
3
3
 2
1
1
2
2
3
3
3
3
3

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 i,j;
	int a[5];
	int rock, scissors, paper;

	while(1){
		
		rock=0; scissors=0; paper=0;
		for(i=0; i<5; i++){
			scanf("%d",&a[i]);
			if(a[i] == 0)
				break;
			if(a[i] == 1){
				rock++;
			}else if(a[i] == 2){
				scissors++;
			}else if(a[i] == 3){
				paper++;
			}
		}
		if(i<5)
			break;

		
		if((rock>0 && scissors>0 && paper>0) || rock == 5 || scissors == 5 || paper == 5){
			for(j=0; j<5; j++)
				printf("3\n");
		}else if(rock>0 && scissors>0){
			for(j=0; j<5; j++)
				if(a[j] == 1) printf("1\n");
				else if(a[j] == 2) printf("2\n");
		}else if(rock>0 && paper>0){
			for(j=0; j<5; j++)
				if(a[j] == 3) printf("1\n");
				else if(a[j] == 1) printf("2\n");
		}else if(scissors>0 && paper>0){
			for(j=0; j<5; j++)
				if(a[j] == 2) printf("1\n");
				else if(a[j] == 3) printf("2\n");
			}

	}
	
	
	return 0;

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"3"
.LC2:
	.string	"1"
.LC3:
	.string	"2"
	.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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L31:
	movl	$0, -44(%rbp)
	movl	$0, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -52(%rbp)
	jmp	.L2
.L8:
	leaq	-32(%rbp), %rdx
	movl	-52(%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
	movl	-52(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L35
	movl	-52(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L5
	addl	$1, -44(%rbp)
	jmp	.L6
.L5:
	movl	-52(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jne	.L7
	addl	$1, -40(%rbp)
	jmp	.L6
.L7:
	movl	-52(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$3, %eax
	jne	.L6
	addl	$1, -36(%rbp)
.L6:
	addl	$1, -52(%rbp)
.L2:
	cmpl	$4, -52(%rbp)
	jle	.L8
	jmp	.L4
.L35:
	nop
.L4:
	cmpl	$4, -52(%rbp)
	jle	.L36
	cmpl	$0, -44(%rbp)
	jle	.L11
	cmpl	$0, -40(%rbp)
	jle	.L11
	cmpl	$0, -36(%rbp)
	jg	.L12
.L11:
	cmpl	$5, -44(%rbp)
	je	.L12
	cmpl	$5, -40(%rbp)
	je	.L12
	cmpl	$5, -36(%rbp)
	jne	.L13
.L12:
	movl	$0, -48(%rbp)
	jmp	.L14
.L15:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -48(%rbp)
.L14:
	cmpl	$4, -48(%rbp)
	jle	.L15
	jmp	.L16
.L13:
	cmpl	$0, -44(%rbp)
	jle	.L17
	cmpl	$0, -40(%rbp)
	jle	.L17
	movl	$0, -48(%rbp)
	jmp	.L18
.L21:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L19
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L20
.L19:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jne	.L20
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L20:
	addl	$1, -48(%rbp)
.L18:
	cmpl	$4, -48(%rbp)
	jle	.L21
	jmp	.L16
.L17:
	cmpl	$0, -44(%rbp)
	jle	.L22
	cmpl	$0, -36(%rbp)
	jle	.L22
	movl	$0, -48(%rbp)
	jmp	.L23
.L26:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$3, %eax
	jne	.L24
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L25
.L24:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L25
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L25:
	addl	$1, -48(%rbp)
.L23:
	cmpl	$4, -48(%rbp)
	jle	.L26
	jmp	.L16
.L22:
	cmpl	$0, -40(%rbp)
	jle	.L31
	cmpl	$0, -36(%rbp)
	jle	.L31
	movl	$0, -48(%rbp)
	jmp	.L27
.L30:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jne	.L28
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L29
.L28:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$3, %eax
	jne	.L29
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L29:
	addl	$1, -48(%rbp)
.L27:
	cmpl	$4, -48(%rbp)
	jle	.L30
.L16:
	jmp	.L31
.L36:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	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	"3"
.LC2:
	.string	"1"
.LC3:
	.string	"2"
	.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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L31:
	movl	$0, -44(%rbp)
	movl	$0, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -52(%rbp)
	jmp	.L2
.L8:
	leaq	-32(%rbp), %rdx
	movl	-52(%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
	movl	-52(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L35
	movl	-52(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L5
	addl	$1, -44(%rbp)
	jmp	.L6
.L5:
	movl	-52(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jne	.L7
	addl	$1, -40(%rbp)
	jmp	.L6
.L7:
	movl	-52(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$3, %eax
	jne	.L6
	addl	$1, -36(%rbp)
.L6:
	addl	$1, -52(%rbp)
.L2:
	cmpl	$4, -52(%rbp)
	jle	.L8
	jmp	.L4
.L35:
	nop
.L4:
	cmpl	$4, -52(%rbp)
	jle	.L36
	cmpl	$0, -44(%rbp)
	jle	.L11
	cmpl	$0, -40(%rbp)
	jle	.L11
	cmpl	$0, -36(%rbp)
	jg	.L12
.L11:
	cmpl	$5, -44(%rbp)
	je	.L12
	cmpl	$5, -40(%rbp)
	je	.L12
	cmpl	$5, -36(%rbp)
	jne	.L13
.L12:
	movl	$0, -48(%rbp)
	jmp	.L14
.L15:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -48(%rbp)
.L14:
	cmpl	$4, -48(%rbp)
	jle	.L15
	jmp	.L16
.L13:
	cmpl	$0, -44(%rbp)
	jle	.L17
	cmpl	$0, -40(%rbp)
	jle	.L17
	movl	$0, -48(%rbp)
	jmp	.L18
.L21:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L19
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L20
.L19:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jne	.L20
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L20:
	addl	$1, -48(%rbp)
.L18:
	cmpl	$4, -48(%rbp)
	jle	.L21
	jmp	.L16
.L17:
	cmpl	$0, -44(%rbp)
	jle	.L22
	cmpl	$0, -36(%rbp)
	jle	.L22
	movl	$0, -48(%rbp)
	jmp	.L23
.L26:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$3, %eax
	jne	.L24
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L25
.L24:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L25
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L25:
	addl	$1, -48(%rbp)
.L23:
	cmpl	$4, -48(%rbp)
	jle	.L26
	jmp	.L16
.L22:
	cmpl	$0, -40(%rbp)
	jle	.L31
	cmpl	$0, -36(%rbp)
	jle	.L31
	movl	$0, -48(%rbp)
	jmp	.L27
.L30:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jne	.L28
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L29
.L28:
	movl	-48(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$3, %eax
	jne	.L29
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L29:
	addl	$1, -48(%rbp)
.L27:
	cmpl	$4, -48(%rbp)
	jle	.L30
.L16:
	jmp	.L31
.L36:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	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:
