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 array[4];
    int a=0;
    int b=0;
    int c=0;
    int d=0;
    scanf("%d %d %d %d",&array[0],&array[1],&array[2],&array[3]);
    for(int i=0; i<=3; i++){
        if(array[i]==1){
            a++;
        }
        if(array[i]==9){
            b++;
        }
        if(array[i]==7){
            c++;
        }
        if(array[i]==4){
            d++;
        }
    }
    if(a==1 && b==1 && c==1 && d==1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %d"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.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
	movl	$0, -52(%rbp)
	movl	$0, -48(%rbp)
	movl	$0, -44(%rbp)
	movl	$0, -40(%rbp)
	leaq	-32(%rbp), %rax
	leaq	12(%rax), %rsi
	leaq	-32(%rbp), %rax
	leaq	8(%rax), %rcx
	leaq	-32(%rbp), %rax
	leaq	4(%rax), %rdx
	leaq	-32(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L2
.L7:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L3
	addl	$1, -52(%rbp)
.L3:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$9, %eax
	jne	.L4
	addl	$1, -48(%rbp)
.L4:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$7, %eax
	jne	.L5
	addl	$1, -44(%rbp)
.L5:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$4, %eax
	jne	.L6
	addl	$1, -40(%rbp)
.L6:
	addl	$1, -36(%rbp)
.L2:
	cmpl	$3, -36(%rbp)
	jle	.L7
	cmpl	$1, -52(%rbp)
	jne	.L8
	cmpl	$1, -48(%rbp)
	jne	.L8
	cmpl	$1, -44(%rbp)
	jne	.L8
	cmpl	$1, -40(%rbp)
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L9
.L8:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L9:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	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	"YES"
.LC2:
	.string	"NO"
	.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
	movq	%rsp, %rsi
	leaq	8(%rsp), %rcx
	leaq	4(%rsp), %rdx
	leaq	12(%rsp), %r8
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	cmpl	$1, %eax
	je	.L41
	cmpl	$9, %eax
	jne	.L42
	xorl	%ecx, %ecx
	movl	$1, %edx
	xorl	%eax, %eax
	xorl	%esi, %esi
.L2:
	movl	4(%rsp), %edi
	cmpl	$1, %edi
	je	.L43
	cmpl	$9, %edi
	jne	.L8
	addl	$1, %edx
.L7:
	movl	8(%rsp), %edi
	cmpl	$1, %edi
	je	.L44
	cmpl	$9, %edi
	jne	.L13
	addl	$1, %edx
.L12:
	movl	12(%rsp), %edi
	cmpl	$1, %edi
	je	.L45
	cmpl	$9, %edi
	je	.L17
	cmpl	$7, %edi
	jne	.L18
	addl	$1, %ecx
.L16:
	cmpl	$1, %eax
	jne	.L19
	cmpl	$1, %edx
	jne	.L19
	cmpl	$1, %ecx
	jne	.L19
	subl	$1, %esi
	jne	.L19
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L20:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L46
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L42:
	.cfi_restore_state
	cmpl	$7, %eax
	jne	.L4
	movl	$1, %ecx
	xorl	%edx, %edx
	xorl	%eax, %eax
	xorl	%esi, %esi
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L19:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L20
.L41:
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	xorl	%esi, %esi
	jmp	.L2
.L13:
	cmpl	$7, %edi
	jne	.L14
	addl	$1, %ecx
	jmp	.L12
.L44:
	addl	$1, %eax
	jmp	.L12
.L14:
	cmpl	$4, %edi
	jne	.L12
	addl	$1, %esi
	jmp	.L12
.L8:
	cmpl	$7, %edi
	jne	.L9
	addl	$1, %ecx
	jmp	.L7
.L43:
	addl	$1, %eax
	jmp	.L7
.L9:
	cmpl	$4, %edi
	jne	.L7
	addl	$1, %esi
	jmp	.L7
.L17:
	addl	$1, %edx
	jmp	.L16
.L45:
	addl	$1, %eax
	jmp	.L16
.L18:
	cmpl	$4, %edi
	jne	.L16
	addl	$1, %esi
	jmp	.L16
.L4:
	xorl	%esi, %esi
	cmpl	$4, %eax
	sete	%sil
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L2
.L46:
	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	"YES"
.LC2:
	.string	"NO"
	.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
	movq	%rsp, %rsi
	leaq	8(%rsp), %rcx
	leaq	4(%rsp), %rdx
	leaq	12(%rsp), %r8
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	cmpl	$1, %eax
	je	.L41
	cmpl	$9, %eax
	jne	.L42
	xorl	%ecx, %ecx
	movl	$1, %edx
	xorl	%eax, %eax
	xorl	%esi, %esi
.L2:
	movl	4(%rsp), %edi
	cmpl	$1, %edi
	je	.L43
	cmpl	$9, %edi
	jne	.L8
	addl	$1, %edx
.L7:
	movl	8(%rsp), %edi
	cmpl	$1, %edi
	je	.L44
	cmpl	$9, %edi
	jne	.L13
	addl	$1, %edx
.L12:
	movl	12(%rsp), %edi
	cmpl	$1, %edi
	je	.L45
	cmpl	$9, %edi
	je	.L17
	cmpl	$7, %edi
	jne	.L18
	addl	$1, %ecx
.L16:
	cmpl	$1, %eax
	jne	.L19
	cmpl	$1, %edx
	jne	.L19
	cmpl	$1, %ecx
	jne	.L19
	subl	$1, %esi
	jne	.L19
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L20:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L46
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L42:
	.cfi_restore_state
	cmpl	$7, %eax
	jne	.L4
	movl	$1, %ecx
	xorl	%edx, %edx
	xorl	%eax, %eax
	xorl	%esi, %esi
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L19:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L20
.L41:
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	xorl	%esi, %esi
	jmp	.L2
.L13:
	cmpl	$7, %edi
	jne	.L14
	addl	$1, %ecx
	jmp	.L12
.L44:
	addl	$1, %eax
	jmp	.L12
.L14:
	cmpl	$4, %edi
	jne	.L12
	addl	$1, %esi
	jmp	.L12
.L8:
	cmpl	$7, %edi
	jne	.L9
	addl	$1, %ecx
	jmp	.L7
.L43:
	addl	$1, %eax
	jmp	.L7
.L9:
	cmpl	$4, %edi
	jne	.L7
	addl	$1, %esi
	jmp	.L7
.L17:
	addl	$1, %edx
	jmp	.L16
.L45:
	addl	$1, %eax
	jmp	.L16
.L18:
	cmpl	$4, %edi
	jne	.L16
	addl	$1, %esi
	jmp	.L16
.L4:
	xorl	%esi, %esi
	cmpl	$4, %eax
	sete	%sil
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L2
.L46:
	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 array[4];
    int a=0;
    int b=0;
    int c=0;
    int d=0;
    scanf("%d %d %d %d",&array[0],&array[1],&array[2],&array[3]);
    for(int i=0; i<=3; i++){
        if(array[i]==1){
            a++;
        }
        if(array[i]==9){
            b++;
        }
        if(array[i]==7){
            c++;
        }
        if(array[i]==4){
            d++;
        }
    }
    if(a==1 && b==1 && c==1 && d==1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
    return 0;
}
1 9 13 4
 1 2 3 1
 4 9 0 13
 0 7 9 4
 1 9 13 3
 1 3 3 1
 3 9 0 13
 1 12 9 4
 1 9 13 0
 1 2 3 2

NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO

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 array[4];
    int a=0;
    int b=0;
    int c=0;
    int d=0;
    scanf("%d %d %d %d",&array[0],&array[1],&array[2],&array[3]);
    for(int i=0; i<=3; i++){
        if(array[i]==1){
            a++;
        }
        if(array[i]==9){
            b++;
        }
        if(array[i]==7){
            c++;
        }
        if(array[i]==4){
            d++;
        }
    }
    if(a==1 && b==1 && c==1 && d==1){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %d"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.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
	movl	$0, -52(%rbp)
	movl	$0, -48(%rbp)
	movl	$0, -44(%rbp)
	movl	$0, -40(%rbp)
	leaq	-32(%rbp), %rax
	leaq	12(%rax), %rsi
	leaq	-32(%rbp), %rax
	leaq	8(%rax), %rcx
	leaq	-32(%rbp), %rax
	leaq	4(%rax), %rdx
	leaq	-32(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L2
.L7:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L3
	addl	$1, -52(%rbp)
.L3:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$9, %eax
	jne	.L4
	addl	$1, -48(%rbp)
.L4:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$7, %eax
	jne	.L5
	addl	$1, -44(%rbp)
.L5:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$4, %eax
	jne	.L6
	addl	$1, -40(%rbp)
.L6:
	addl	$1, -36(%rbp)
.L2:
	cmpl	$3, -36(%rbp)
	jle	.L7
	cmpl	$1, -52(%rbp)
	jne	.L8
	cmpl	$1, -48(%rbp)
	jne	.L8
	cmpl	$1, -44(%rbp)
	jne	.L8
	cmpl	$1, -40(%rbp)
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L9
.L8:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L9:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	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	"YES"
.LC2:
	.string	"NO"
	.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
	movl	$0, -52(%rbp)
	movl	$0, -48(%rbp)
	movl	$0, -44(%rbp)
	movl	$0, -40(%rbp)
	leaq	-32(%rbp), %rax
	leaq	12(%rax), %rsi
	leaq	-32(%rbp), %rax
	leaq	8(%rax), %rcx
	leaq	-32(%rbp), %rax
	leaq	4(%rax), %rdx
	leaq	-32(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L2
.L7:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L3
	addl	$1, -52(%rbp)
.L3:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$9, %eax
	jne	.L4
	addl	$1, -48(%rbp)
.L4:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$7, %eax
	jne	.L5
	addl	$1, -44(%rbp)
.L5:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cmpl	$4, %eax
	jne	.L6
	addl	$1, -40(%rbp)
.L6:
	addl	$1, -36(%rbp)
.L2:
	cmpl	$3, -36(%rbp)
	jle	.L7
	cmpl	$1, -52(%rbp)
	jne	.L8
	cmpl	$1, -48(%rbp)
	jne	.L8
	cmpl	$1, -44(%rbp)
	jne	.L8
	cmpl	$1, -40(%rbp)
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L9
.L8:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L9:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	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:
