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(void)
{
    int a,b,c,d,i,s,g,t=0;
    
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a<c) s=a;
    else s=c;
    if(b>d) g=b;
    else g=d;
    for(i=s;i<=g;i++)
        if(((a<=i)&&(i<b))&&((c<=i)&&(i<d)))
            t++;
    printf("%d\n",t);
    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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -12(%rbp)
	leaq	-28(%rbp), %rsi
	leaq	-32(%rbp), %rcx
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L2
	movl	-40(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L3
.L2:
	movl	-32(%rbp), %eax
	movl	%eax, -20(%rbp)
.L3:
	movl	-36(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	-36(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L5
.L4:
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
.L5:
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L6
.L8:
	movl	-40(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L7
	movl	-36(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L7
	movl	-32(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L7
	movl	-28(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L7
	addl	$1, -12(%rbp)
.L7:
	addl	$1, -24(%rbp)
.L6:
	movl	-24(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jle	.L8
	movl	-12(%rbp), %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	.L10
	call	__stack_chk_fail@PLT
.L10:
	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"
.LC3:
	.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	16(%rsp), %rcx
	leaq	8(%rsp), %rsi
	leaq	20(%rsp), %r8
	leaq	12(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %edi
	movl	16(%rsp), %esi
	movl	12(%rsp), %r8d
	movl	20(%rsp), %r9d
	cmpl	%esi, %edi
	movl	%esi, %ecx
	cmovle	%edi, %ecx
	movl	%r9d, %r10d
	cmpl	%r9d, %r8d
	cmovge	%r8d, %r10d
	cmpl	%r10d, %ecx
	jg	.L13
	movl	%r10d, %eax
	subl	%ecx, %eax
	leal	1(%rax), %r11d
	cmpl	$2, %eax
	jbe	.L14
	movd	%ecx, %xmm6
	movd	%r8d, %xmm7
	movl	%r11d, %edx
	xorl	%eax, %eax
	pshufd	$0, %xmm6, %xmm4
	movd	%edi, %xmm6
	pshufd	$0, %xmm7, %xmm10
	shrl	$2, %edx
	movd	%esi, %xmm7
	pshufd	$0, %xmm6, %xmm9
	movd	%r9d, %xmm6
	pshufd	$0, %xmm7, %xmm8
	pxor	%xmm3, %xmm3
	pshufd	$0, %xmm6, %xmm7
	movdqa	.LC2(%rip), %xmm6
	paddd	.LC1(%rip), %xmm4
	movdqa	%xmm3, %xmm5
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm4, %xmm2
	movdqa	%xmm9, %xmm1
	movdqa	%xmm10, %xmm0
	addl	$1, %eax
	pcmpgtd	%xmm2, %xmm1
	pcmpgtd	%xmm2, %xmm0
	movdqa	%xmm7, %xmm11
	pcmpgtd	%xmm2, %xmm11
	paddd	%xmm6, %xmm4
	pcmpeqd	%xmm5, %xmm1
	pand	%xmm1, %xmm0
	movdqa	%xmm8, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pcmpeqd	%xmm5, %xmm1
	pand	%xmm11, %xmm1
	pand	%xmm1, %xmm0
	psubd	%xmm0, %xmm3
	cmpl	%edx, %eax
	jne	.L4
	movdqa	%xmm3, %xmm0
	movl	%r11d, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm3
	addl	%eax, %ecx
	movdqa	%xmm3, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm3
	movd	%xmm3, %edx
	cmpl	%eax, %r11d
	je	.L2
.L3:
	cmpl	%ecx, %edi
	setle	%al
	cmpl	%ecx, %r8d
	setg	%r11b
	andl	%r11d, %eax
	cmpl	%ecx, %esi
	setle	%r11b
	testb	%r11b, %al
	je	.L7
	cmpl	%ecx, %r9d
	setg	%al
	cmpb	$1, %al
	sbbl	$-1, %edx
.L7:
	leal	1(%rcx), %eax
	cmpl	%r10d, %eax
	jg	.L2
	cmpl	%eax, %edi
	setle	%r11b
	cmpl	%eax, %r8d
	setg	%bl
	andl	%ebx, %r11d
	cmpl	%eax, %esi
	setle	%bl
	testb	%bl, %r11b
	je	.L8
	cmpl	%eax, %r9d
	setg	%al
	cmpb	$1, %al
	sbbl	$-1, %edx
.L8:
	addl	$2, %ecx
	cmpl	%ecx, %r10d
	jl	.L2
	cmpl	%ecx, %r8d
	setg	%al
	cmpl	%ecx, %edi
	setle	%dil
	andl	%edi, %eax
	cmpl	%ecx, %esi
	setle	%sil
	testb	%sil, %al
	je	.L2
	cmpl	%ecx, %r9d
	setg	%al
	cmpb	$1, %al
	sbbl	$-1, %edx
.L2:
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L2
.L14:
	xorl	%edx, %edx
	jmp	.L3
.L31:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.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"
.LC3:
	.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	16(%rsp), %rcx
	leaq	8(%rsp), %rsi
	leaq	20(%rsp), %r8
	leaq	12(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %edi
	movl	16(%rsp), %esi
	movl	12(%rsp), %r8d
	movl	20(%rsp), %r9d
	cmpl	%esi, %edi
	movl	%esi, %ecx
	cmovle	%edi, %ecx
	movl	%r9d, %r10d
	cmpl	%r9d, %r8d
	cmovge	%r8d, %r10d
	cmpl	%r10d, %ecx
	jg	.L13
	movl	%r10d, %eax
	subl	%ecx, %eax
	leal	1(%rax), %r11d
	cmpl	$2, %eax
	jbe	.L14
	movd	%ecx, %xmm6
	movd	%r8d, %xmm7
	movl	%r11d, %edx
	xorl	%eax, %eax
	pshufd	$0, %xmm6, %xmm4
	movd	%edi, %xmm6
	pshufd	$0, %xmm7, %xmm10
	shrl	$2, %edx
	movd	%esi, %xmm7
	pshufd	$0, %xmm6, %xmm9
	movd	%r9d, %xmm6
	pshufd	$0, %xmm7, %xmm8
	pxor	%xmm3, %xmm3
	pshufd	$0, %xmm6, %xmm7
	movdqa	.LC2(%rip), %xmm6
	paddd	.LC1(%rip), %xmm4
	movdqa	%xmm3, %xmm5
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm4, %xmm2
	movdqa	%xmm9, %xmm1
	movdqa	%xmm10, %xmm0
	addl	$1, %eax
	pcmpgtd	%xmm2, %xmm1
	pcmpgtd	%xmm2, %xmm0
	movdqa	%xmm7, %xmm11
	pcmpgtd	%xmm2, %xmm11
	paddd	%xmm6, %xmm4
	pcmpeqd	%xmm5, %xmm1
	pand	%xmm1, %xmm0
	movdqa	%xmm8, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pcmpeqd	%xmm5, %xmm1
	pand	%xmm11, %xmm1
	pand	%xmm1, %xmm0
	psubd	%xmm0, %xmm3
	cmpl	%edx, %eax
	jne	.L4
	movdqa	%xmm3, %xmm0
	movl	%r11d, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm3
	addl	%eax, %ecx
	movdqa	%xmm3, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm3
	movd	%xmm3, %edx
	cmpl	%eax, %r11d
	je	.L2
.L3:
	cmpl	%ecx, %edi
	setle	%al
	cmpl	%ecx, %r8d
	setg	%r11b
	andl	%r11d, %eax
	cmpl	%ecx, %esi
	setle	%r11b
	testb	%r11b, %al
	je	.L7
	cmpl	%ecx, %r9d
	setg	%al
	cmpb	$1, %al
	sbbl	$-1, %edx
.L7:
	leal	1(%rcx), %eax
	cmpl	%r10d, %eax
	jg	.L2
	cmpl	%eax, %edi
	setle	%r11b
	cmpl	%eax, %r8d
	setg	%bl
	andl	%ebx, %r11d
	cmpl	%eax, %esi
	setle	%bl
	testb	%bl, %r11b
	je	.L8
	cmpl	%eax, %r9d
	setg	%al
	cmpb	$1, %al
	sbbl	$-1, %edx
.L8:
	addl	$2, %ecx
	cmpl	%ecx, %r10d
	jl	.L2
	cmpl	%ecx, %r8d
	setg	%al
	cmpl	%ecx, %edi
	setle	%dil
	andl	%edi, %eax
	cmpl	%ecx, %esi
	setle	%sil
	testb	%sil, %al
	je	.L2
	cmpl	%ecx, %r9d
	setg	%al
	cmpb	$1, %al
	sbbl	$-1, %edx
.L2:
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L2
.L14:
	xorl	%edx, %edx
	jmp	.L3
.L31:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.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(void)
{
    int a,b,c,d,i,s,g,t=0;
    
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a<c) s=a;
    else s=c;
    if(b>d) g=b;
    else g=d;
    for(i=s;i<=g;i++)
        if(((a<=i)&&(i<b))&&((c<=i)&&(i<d)))
            t++;
    printf("%d\n",t);
    return 0;
}
10 17 20 80
 1 75 25 100
 1 80 25 100
 -1 2 1 10
 10 90 20 58
 0 75 22 100
 1 72 25 100
 1 34 25 100
 -1 3 1 10
 0 75 36 100

0
 50
 55
 1
 38
 53
 47
 9
 2
 39

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(void)
{
    int a,b,c,d,i,s,g,t=0;
    
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(a<c) s=a;
    else s=c;
    if(b>d) g=b;
    else g=d;
    for(i=s;i<=g;i++)
        if(((a<=i)&&(i<b))&&((c<=i)&&(i<d)))
            t++;
    printf("%d\n",t);
    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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -12(%rbp)
	leaq	-28(%rbp), %rsi
	leaq	-32(%rbp), %rcx
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L2
	movl	-40(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L3
.L2:
	movl	-32(%rbp), %eax
	movl	%eax, -20(%rbp)
.L3:
	movl	-36(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	-36(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L5
.L4:
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
.L5:
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L6
.L8:
	movl	-40(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L7
	movl	-36(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L7
	movl	-32(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L7
	movl	-28(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L7
	addl	$1, -12(%rbp)
.L7:
	addl	$1, -24(%rbp)
.L6:
	movl	-24(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jle	.L8
	movl	-12(%rbp), %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	.L10
	call	__stack_chk_fail@PLT
.L10:
	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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -12(%rbp)
	leaq	-28(%rbp), %rsi
	leaq	-32(%rbp), %rcx
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L2
	movl	-40(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L3
.L2:
	movl	-32(%rbp), %eax
	movl	%eax, -20(%rbp)
.L3:
	movl	-36(%rbp), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	-36(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L5
.L4:
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
.L5:
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L6
.L8:
	movl	-40(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L7
	movl	-36(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L7
	movl	-32(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L7
	movl	-28(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L7
	addl	$1, -12(%rbp)
.L7:
	addl	$1, -24(%rbp)
.L6:
	movl	-24(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jle	.L8
	movl	-12(%rbp), %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	.L10
	call	__stack_chk_fail@PLT
.L10:
	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:
