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<stdlib.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef struct{
    int n; //ブロック中の文字数
    int c; //ブロックの文字
    int begin; //ブロック開始場所の添字
    int end; //ブロック終了場所の添字
}block;

void array_blocked_3(int* S, int N, block* A){
    int a=0;
    int count=1;

    A[a].begin=0;

    for(int i=1;i<N;i++){
        if(S[i-1]==S[i]){
            count++;
        }
        else{
            A[a].n=count;
            A[a].c=S[i-1];
            A[a].end=i-1;
            a++;
            A[a].begin=i;
            count=1;
        }
    }
    A[a].n=count;
    A[a].c=S[N-1];
    A[a].end=N-1;
    return;
}

//昇順
int asc(const void* a, const void* b){
    return *(int*)a-*(int*)b;
}

//ブロック降順
int block_asc(const void* a, const void* b){
    block p=*(block*)a;
    block q=*(block*)b;
    return q.n-p.n;
}

int main(void){
    int N;
    scanf("%d",&N);

    //奇数番目、偶数番目の要素数
    int n=N/2;

    //奇数番目、偶数番目の数列を分けて格納→昇順ソート
    int* odd;
    int* even;
    NEW(odd,n);
    NEW(even,n);
    for(int i=0;i<n;i++){
        scanf("%d",&odd[i]);
        scanf("%d",&even[i]);
    }

    qsort(odd,n,sizeof(int),asc);
    qsort(even,n,sizeof(int),asc);

    block* b_odd;
    block* b_even;
    NEW(b_odd,n);
    NEW(b_even,n);
    for(int i=0;i<n;i++){
        b_odd[i].n=-1;
        b_even[i].n=-1;
    }
    array_blocked_3(odd,n,b_odd);
    array_blocked_3(even,n,b_even);

    int odd_block_num=0;
    int even_block_num=0;
    for(int i=0;i<n;i++){
        if(b_odd[i].n==-1) break;
        else odd_block_num++;
    }
    for(int i=0;i<n;i++){
        if(b_even[i].n==-1) break;
        else even_block_num++;
    }
    qsort(b_odd,odd_block_num,sizeof(block),block_asc);
    qsort(b_even,even_block_num,sizeof(block),block_asc);

    int ans;
    if(b_odd[0].c!=b_even[0].c) ans=N-(b_odd[0].n+b_even[0].n);
    else{
        if(b_odd[1].n==-1 && b_even[1].n==-1) ans=n;
        else if(b_odd[1].n==-1 && b_even[1].n!=-1) ans=MIN(N-(b_even[0].n),N-(b_odd[0].n+b_even[1].n));
        else if(b_odd[1].n!=-1 && b_even[1].n==-1) ans=MIN(N-(b_odd[0].n),N-(b_odd[1].n+b_even[0].n));
        else ans=MIN(N-(b_odd[1].n+b_even[0].n),N-(b_odd[0].n+b_even[1].n));
    }
    printf("%d\n",ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	array_blocked_3
	.type	array_blocked_3, @function
array_blocked_3:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	%rdx, -40(%rbp)
	movl	$0, -12(%rbp)
	movl	$1, -8(%rbp)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, 8(%rax)
	movl	$1, -4(%rbp)
	jmp	.L2
.L5:
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L3
	addl	$1, -8(%rbp)
	jmp	.L4
.L3:
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, 4(%rdx)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-4(%rbp), %edx
	subl	$1, %edx
	movl	%edx, 12(%rax)
	addl	$1, -12(%rbp)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, 8(%rdx)
	movl	$1, -8(%rbp)
.L4:
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L5
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, 4(%rdx)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-28(%rbp), %edx
	subl	$1, %edx
	movl	%edx, 12(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	array_blocked_3, .-array_blocked_3
	.globl	asc
	.type	asc, @function
asc:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	asc, .-asc
	.globl	block_asc
	.type	block_asc, @function
block_asc:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movq	%rsi, -48(%rbp)
	movq	-40(%rbp), %rax
	movq	8(%rax), %rdx
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movq	%rdx, -24(%rbp)
	movq	-48(%rbp), %rax
	movq	8(%rax), %rdx
	movq	(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	%rdx, -8(%rbp)
	movl	-16(%rbp), %eax
	movl	-32(%rbp), %edx
	subl	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	block_asc, .-block_asc
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-76(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -44(%rbp)
	movl	-44(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	cmpq	$0, -40(%rbp)
	jne	.L12
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L12:
	movl	-44(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	cmpq	$0, -32(%rbp)
	jne	.L13
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L13:
	movl	$0, -72(%rbp)
	jmp	.L14
.L15:
	movl	-72(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-72(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -72(%rbp)
.L14:
	movl	-72(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L15
	movl	-44(%rbp), %eax
	movslq	%eax, %rsi
	movq	-40(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-44(%rbp), %eax
	movslq	%eax, %rsi
	movq	-32(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-44(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	cmpq	$0, -24(%rbp)
	jne	.L16
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L16:
	movl	-44(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L17
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L17:
	movl	$0, -68(%rbp)
	jmp	.L18
.L19:
	movl	-68(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	movl	-68(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -68(%rbp)
.L18:
	movl	-68(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L19
	movq	-24(%rbp), %rdx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	array_blocked_3
	movq	-16(%rbp), %rdx
	movl	-44(%rbp), %ecx
	movq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	array_blocked_3
	movl	$0, -64(%rbp)
	movl	$0, -60(%rbp)
	movl	$0, -56(%rbp)
	jmp	.L20
.L23:
	movl	-56(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L41
	addl	$1, -64(%rbp)
	addl	$1, -56(%rbp)
.L20:
	movl	-56(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L23
	jmp	.L22
.L41:
	nop
.L22:
	movl	$0, -52(%rbp)
	jmp	.L24
.L27:
	movl	-52(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L42
	addl	$1, -60(%rbp)
	addl	$1, -52(%rbp)
.L24:
	movl	-52(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L27
	jmp	.L26
.L42:
	nop
.L26:
	movl	-64(%rbp), %eax
	movslq	%eax, %rsi
	movq	-24(%rbp), %rax
	leaq	block_asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-60(%rbp), %eax
	movslq	%eax, %rsi
	movq	-16(%rbp), %rax
	leaq	block_asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movq	-24(%rbp), %rax
	movl	4(%rax), %edx
	movq	-16(%rbp), %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	je	.L28
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -48(%rbp)
	jmp	.L29
.L28:
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L30
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L30
	movl	-44(%rbp), %eax
	movl	%eax, -48(%rbp)
	jmp	.L29
.L30:
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L31
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L31
	movq	-24(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L32
	movl	-76(%rbp), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	jmp	.L33
.L32:
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
.L33:
	movl	%eax, -48(%rbp)
	jmp	.L29
.L31:
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L34
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L34
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L35
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	jmp	.L36
.L35:
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
.L36:
	movl	%eax, -48(%rbp)
	jmp	.L29
.L34:
	movq	-24(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%ecx, %eax
	cmpl	%eax, %edx
	jge	.L37
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	jmp	.L38
.L37:
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
.L38:
	movl	%eax, -48(%rbp)
.L29:
	movl	-48(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L40
	call	__stack_chk_fail@PLT
.L40:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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
	.p2align 4
	.globl	asc
	.type	asc, @function
asc:
.LFB40:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE40:
	.size	asc, .-asc
	.p2align 4
	.globl	block_asc
	.type	block_asc, @function
block_asc:
.LFB41:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE41:
	.size	block_asc, .-block_asc
	.p2align 4
	.globl	array_blocked_3
	.type	array_blocked_3, @function
array_blocked_3:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rdi, %r8
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	$0, 8(%rdx)
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	cmpl	$1, %esi
	jle	.L9
	leal	-1(%rsi), %ebx
	xorl	%eax, %eax
	movl	$1, %r10d
	xorl	%r9d, %r9d
	movq	%rbx, %rbp
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%r10d, (%rcx)
	movl	(%r8,%rax,4), %r10d
	addl	$1, %r9d
	movl	%eax, 12(%rcx)
	addq	$1, %rax
	movl	%r10d, 4(%rcx)
	leaq	16(%rdx,%rdi), %rcx
	movl	$1, %r10d
	movl	%r11d, 8(%rcx)
	cmpq	%rbx, %rax
	je	.L5
.L8:
	movslq	%r9d, %rdi
	movl	4(%r8,%rax,4), %r14d
	leal	1(%rax), %r11d
	salq	$4, %rdi
	leaq	(%rdx,%rdi), %rcx
	cmpl	%r14d, (%r8,%rax,4)
	jne	.L6
	addq	$1, %rax
	addl	$1, %r10d
	cmpq	%rbx, %rax
	jne	.L8
.L5:
	movslq	%esi, %rsi
	movl	%r10d, (%rcx)
	movl	-4(%r8,%rsi,4), %eax
	movl	%ebp, 12(%rcx)
	movl	%eax, 4(%rcx)
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	movq	%rdx, %rcx
	movl	$1, %r10d
	leal	-1(%rsi), %ebp
	jmp	.L5
	.cfi_endproc
.LFE39:
	.size	array_blocked_3, .-array_blocked_3
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB42:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	movl	%eax, %r8d
	movl	%eax, 20(%rsp)
	shrl	$31, %r8d
	addl	%eax, %r8d
	sarl	%r8d
	movslq	%r8d, %r12
	leaq	0(,%r12,4), %r13
	movl	%r12d, 16(%rsp)
	movq	%r13, %rdi
	call	malloc@PLT
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	je	.L14
	movq	%r13, %rdi
	call	malloc@PLT
	movq	%rax, 24(%rsp)
	movq	%rax, %rbx
	testq	%rax, %rax
	je	.L14
	xorl	%r13d, %r13d
	cmpl	$1, 20(%rsp)
	movq	8(%rsp), %r14
	movq	%r12, %r15
	jle	.L18
	.p2align 4,,10
	.p2align 3
.L17:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addq	$4, %r14
	addq	$4, %rbx
	cmpl	%r13d, %r15d
	jg	.L17
.L18:
	movq	8(%rsp), %rdi
	leaq	asc(%rip), %rbx
	movq	%r12, %rsi
	movl	$4, %edx
	movq	%rbx, %rcx
	call	qsort@PLT
	movq	24(%rsp), %rdi
	movq	%r12, %rsi
	movq	%rbx, %rcx
	movl	$4, %edx
	salq	$4, %r12
	call	qsort@PLT
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%rax, %rbp
	testq	%rax, %rax
	je	.L14
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%rax, %r12
	testq	%rax, %rax
	je	.L14
	cmpl	$1, 20(%rsp)
	jle	.L19
	xorl	%eax, %eax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L20:
	addl	$1, %edx
	movl	$-1, 0(%rbp,%rax)
	movl	$-1, (%r12,%rax)
	addq	$16, %rax
	cmpl	%edx, %r15d
	jg	.L20
	movq	8(%rsp), %rdi
	movq	%rbp, %rdx
	movl	%r15d, %esi
	call	array_blocked_3
	movq	24(%rsp), %rdi
	movl	%r15d, %esi
	movq	%r12, %rdx
	call	array_blocked_3
	movq	%rbp, %rax
	xorl	%esi, %esi
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L58:
	addl	$1, %esi
	addq	$16, %rax
	cmpl	%esi, %r15d
	jle	.L22
.L23:
	cmpl	$-1, (%rax)
	jne	.L58
.L22:
	movq	%r12, %rax
	xorl	%ebx, %ebx
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L59:
	addl	$1, %ebx
	addq	$16, %rax
	cmpl	%ebx, %r15d
	jle	.L24
.L25:
	cmpl	$-1, (%rax)
	jne	.L59
.L24:
	leaq	block_asc(%rip), %r13
	movslq	%esi, %rsi
	movl	$16, %edx
	movq	%rbp, %rdi
	movq	%r13, %rcx
	call	qsort@PLT
	movslq	%ebx, %rsi
	movq	%r13, %rcx
	movl	$16, %edx
	movq	%r12, %rdi
	call	qsort@PLT
	movl	4(%r12), %eax
	cmpl	%eax, 4(%rbp)
	je	.L26
	movl	36(%rsp), %ecx
	movl	(%r12), %eax
	addl	0(%rbp), %eax
	subl	%eax, %ecx
	movl	%ecx, 16(%rsp)
.L27:
	movl	16(%rsp), %edx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L60
	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
.L26:
	.cfi_restore_state
	movl	16(%rbp), %edx
	movl	16(%r12), %eax
	cmpl	$-1, %edx
	je	.L61
	movl	0(%rbp), %esi
	movl	36(%rsp), %ecx
	addl	(%r12), %edx
	cmpl	$-1, %eax
	je	.L62
	addl	%esi, %eax
.L57:
	movl	%ecx, %edi
	subl	%eax, %edi
	movl	%edi, 16(%rsp)
	cmpl	%edx, %eax
	jge	.L27
	subl	%edx, %ecx
	movl	%ecx, 16(%rsp)
	jmp	.L27
.L62:
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, 16(%rsp)
	cmpl	%edx, %esi
	jle	.L27
	subl	%esi, %ecx
	movl	%ecx, 16(%rsp)
	jmp	.L27
.L61:
	cmpl	$-1, %eax
	je	.L27
	movl	(%r12), %edx
	movl	36(%rsp), %ecx
	addl	0(%rbp), %eax
	jmp	.L57
.L19:
	movq	8(%rsp), %rdi
	movq	%rbp, %rdx
	movl	%r15d, %esi
	xorl	%ebx, %ebx
	call	array_blocked_3
	movq	24(%rsp), %rdi
	movl	%r15d, %esi
	movq	%r12, %rdx
	call	array_blocked_3
	xorl	%esi, %esi
	jmp	.L24
.L14:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L60:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE42:
	.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
	.p2align 4
	.globl	asc
	.type	asc, @function
asc:
.LFB40:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE40:
	.size	asc, .-asc
	.p2align 4
	.globl	block_asc
	.type	block_asc, @function
block_asc:
.LFB41:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE41:
	.size	block_asc, .-block_asc
	.p2align 4
	.globl	array_blocked_3
	.type	array_blocked_3, @function
array_blocked_3:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rdi, %r8
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	$0, 8(%rdx)
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	cmpl	$1, %esi
	jle	.L9
	leal	-1(%rsi), %ebx
	xorl	%eax, %eax
	movl	$1, %r10d
	xorl	%r9d, %r9d
	movq	%rbx, %rbp
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%r10d, (%rcx)
	movl	(%r8,%rax,4), %r10d
	addl	$1, %r9d
	movl	%eax, 12(%rcx)
	addq	$1, %rax
	movl	%r10d, 4(%rcx)
	leaq	16(%rdx,%rdi), %rcx
	movl	$1, %r10d
	movl	%r11d, 8(%rcx)
	cmpq	%rbx, %rax
	je	.L5
.L8:
	movslq	%r9d, %rdi
	movl	4(%r8,%rax,4), %r14d
	leal	1(%rax), %r11d
	salq	$4, %rdi
	leaq	(%rdx,%rdi), %rcx
	cmpl	%r14d, (%r8,%rax,4)
	jne	.L6
	addq	$1, %rax
	addl	$1, %r10d
	cmpq	%rbx, %rax
	jne	.L8
.L5:
	movslq	%esi, %rsi
	movl	%r10d, (%rcx)
	movl	-4(%r8,%rsi,4), %eax
	movl	%ebp, 12(%rcx)
	movl	%eax, 4(%rcx)
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	movq	%rdx, %rcx
	movl	$1, %r10d
	leal	-1(%rsi), %ebp
	jmp	.L5
	.cfi_endproc
.LFE39:
	.size	array_blocked_3, .-array_blocked_3
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB42:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	movl	%eax, %r8d
	movl	%eax, 20(%rsp)
	shrl	$31, %r8d
	addl	%eax, %r8d
	sarl	%r8d
	movslq	%r8d, %r12
	leaq	0(,%r12,4), %r13
	movl	%r12d, 16(%rsp)
	movq	%r13, %rdi
	call	malloc@PLT
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	je	.L14
	movq	%r13, %rdi
	call	malloc@PLT
	movq	%rax, 24(%rsp)
	movq	%rax, %rbx
	testq	%rax, %rax
	je	.L14
	xorl	%r13d, %r13d
	cmpl	$1, 20(%rsp)
	movq	8(%rsp), %r14
	movq	%r12, %r15
	jle	.L18
	.p2align 4,,10
	.p2align 3
.L17:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addq	$4, %r14
	addq	$4, %rbx
	cmpl	%r13d, %r15d
	jg	.L17
.L18:
	movq	8(%rsp), %rdi
	leaq	asc(%rip), %rbx
	movq	%r12, %rsi
	movl	$4, %edx
	movq	%rbx, %rcx
	call	qsort@PLT
	movq	24(%rsp), %rdi
	movq	%r12, %rsi
	movq	%rbx, %rcx
	movl	$4, %edx
	salq	$4, %r12
	call	qsort@PLT
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%rax, %rbp
	testq	%rax, %rax
	je	.L14
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%rax, %r12
	testq	%rax, %rax
	je	.L14
	cmpl	$1, 20(%rsp)
	jle	.L19
	xorl	%eax, %eax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L20:
	addl	$1, %edx
	movl	$-1, 0(%rbp,%rax)
	movl	$-1, (%r12,%rax)
	addq	$16, %rax
	cmpl	%edx, %r15d
	jg	.L20
	movq	8(%rsp), %rdi
	movq	%rbp, %rdx
	movl	%r15d, %esi
	call	array_blocked_3
	movq	24(%rsp), %rdi
	movl	%r15d, %esi
	movq	%r12, %rdx
	call	array_blocked_3
	movq	%rbp, %rax
	xorl	%esi, %esi
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L58:
	addl	$1, %esi
	addq	$16, %rax
	cmpl	%esi, %r15d
	jle	.L22
.L23:
	cmpl	$-1, (%rax)
	jne	.L58
.L22:
	movq	%r12, %rax
	xorl	%ebx, %ebx
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L59:
	addl	$1, %ebx
	addq	$16, %rax
	cmpl	%ebx, %r15d
	jle	.L24
.L25:
	cmpl	$-1, (%rax)
	jne	.L59
.L24:
	leaq	block_asc(%rip), %r13
	movslq	%esi, %rsi
	movl	$16, %edx
	movq	%rbp, %rdi
	movq	%r13, %rcx
	call	qsort@PLT
	movslq	%ebx, %rsi
	movq	%r13, %rcx
	movl	$16, %edx
	movq	%r12, %rdi
	call	qsort@PLT
	movl	4(%r12), %eax
	cmpl	%eax, 4(%rbp)
	je	.L26
	movl	36(%rsp), %ecx
	movl	(%r12), %eax
	addl	0(%rbp), %eax
	subl	%eax, %ecx
	movl	%ecx, 16(%rsp)
.L27:
	movl	16(%rsp), %edx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L60
	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
.L26:
	.cfi_restore_state
	movl	16(%rbp), %edx
	movl	16(%r12), %eax
	cmpl	$-1, %edx
	je	.L61
	movl	0(%rbp), %esi
	movl	36(%rsp), %ecx
	addl	(%r12), %edx
	cmpl	$-1, %eax
	je	.L62
	addl	%esi, %eax
.L57:
	movl	%ecx, %edi
	subl	%eax, %edi
	movl	%edi, 16(%rsp)
	cmpl	%edx, %eax
	jge	.L27
	subl	%edx, %ecx
	movl	%ecx, 16(%rsp)
	jmp	.L27
.L62:
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, 16(%rsp)
	cmpl	%edx, %esi
	jle	.L27
	subl	%esi, %ecx
	movl	%ecx, 16(%rsp)
	jmp	.L27
.L61:
	cmpl	$-1, %eax
	je	.L27
	movl	(%r12), %edx
	movl	36(%rsp), %ecx
	addl	0(%rbp), %eax
	jmp	.L57
.L19:
	movq	8(%rsp), %rdi
	movq	%rbp, %rdx
	movl	%r15d, %esi
	xorl	%ebx, %ebx
	call	array_blocked_3
	movq	24(%rsp), %rdi
	movl	%r15d, %esi
	movq	%r12, %rdx
	call	array_blocked_3
	xorl	%esi, %esi
	jmp	.L24
.L14:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L60:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE42:
	.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<stdlib.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef struct{
    int n; //ブロック中の文字数
    int c; //ブロックの文字
    int begin; //ブロック開始場所の添字
    int end; //ブロック終了場所の添字
}block;

void array_blocked_3(int* S, int N, block* A){
    int a=0;
    int count=1;

    A[a].begin=0;

    for(int i=1;i<N;i++){
        if(S[i-1]==S[i]){
            count++;
        }
        else{
            A[a].n=count;
            A[a].c=S[i-1];
            A[a].end=i-1;
            a++;
            A[a].begin=i;
            count=1;
        }
    }
    A[a].n=count;
    A[a].c=S[N-1];
    A[a].end=N-1;
    return;
}

//昇順
int asc(const void* a, const void* b){
    return *(int*)a-*(int*)b;
}

//ブロック降順
int block_asc(const void* a, const void* b){
    block p=*(block*)a;
    block q=*(block*)b;
    return q.n-p.n;
}

int main(void){
    int N;
    scanf("%d",&N);

    //奇数番目、偶数番目の要素数
    int n=N/2;

    //奇数番目、偶数番目の数列を分けて格納→昇順ソート
    int* odd;
    int* even;
    NEW(odd,n);
    NEW(even,n);
    for(int i=0;i<n;i++){
        scanf("%d",&odd[i]);
        scanf("%d",&even[i]);
    }

    qsort(odd,n,sizeof(int),asc);
    qsort(even,n,sizeof(int),asc);

    block* b_odd;
    block* b_even;
    NEW(b_odd,n);
    NEW(b_even,n);
    for(int i=0;i<n;i++){
        b_odd[i].n=-1;
        b_even[i].n=-1;
    }
    array_blocked_3(odd,n,b_odd);
    array_blocked_3(even,n,b_even);

    int odd_block_num=0;
    int even_block_num=0;
    for(int i=0;i<n;i++){
        if(b_odd[i].n==-1) break;
        else odd_block_num++;
    }
    for(int i=0;i<n;i++){
        if(b_even[i].n==-1) break;
        else even_block_num++;
    }
    qsort(b_odd,odd_block_num,sizeof(block),block_asc);
    qsort(b_even,even_block_num,sizeof(block),block_asc);

    int ans;
    if(b_odd[0].c!=b_even[0].c) ans=N-(b_odd[0].n+b_even[0].n);
    else{
        if(b_odd[1].n==-1 && b_even[1].n==-1) ans=n;
        else if(b_odd[1].n==-1 && b_even[1].n!=-1) ans=MIN(N-(b_even[0].n),N-(b_odd[0].n+b_even[1].n));
        else if(b_odd[1].n!=-1 && b_even[1].n==-1) ans=MIN(N-(b_odd[0].n),N-(b_odd[1].n+b_even[0].n));
        else ans=MIN(N-(b_odd[1].n+b_even[0].n),N-(b_odd[0].n+b_even[1].n));
    }
    printf("%d\n",ans);

    return 0;
}
4
3 2 3 2
 6
105 119 204 119 105 119
 4
4 1 3 2
 6
105 120 54 119 105 78
 6
105 120 54 119 190 78
 6
105 119 204 119 105 78
 4
4 1 3 0
 6
105 119 54 119 105 78
 4
4 1 3 1
 4
4 1 6 1

0
 1
 2
 3
 4
 2
 2
 2
 1
 1

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<stdlib.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef struct{
    int n; //ブロック中の文字数
    int c; //ブロックの文字
    int begin; //ブロック開始場所の添字
    int end; //ブロック終了場所の添字
}block;

void array_blocked_3(int* S, int N, block* A){
    int a=0;
    int count=1;

    A[a].begin=0;

    for(int i=1;i<N;i++){
        if(S[i-1]==S[i]){
            count++;
        }
        else{
            A[a].n=count;
            A[a].c=S[i-1];
            A[a].end=i-1;
            a++;
            A[a].begin=i;
            count=1;
        }
    }
    A[a].n=count;
    A[a].c=S[N-1];
    A[a].end=N-1;
    return;
}

//昇順
int asc(const void* a, const void* b){
    return *(int*)a-*(int*)b;
}

//ブロック降順
int block_asc(const void* a, const void* b){
    block p=*(block*)a;
    block q=*(block*)b;
    return q.n-p.n;
}

int main(void){
    int N;
    scanf("%d",&N);

    //奇数番目、偶数番目の要素数
    int n=N/2;

    //奇数番目、偶数番目の数列を分けて格納→昇順ソート
    int* odd;
    int* even;
    NEW(odd,n);
    NEW(even,n);
    for(int i=0;i<n;i++){
        scanf("%d",&odd[i]);
        scanf("%d",&even[i]);
    }

    qsort(odd,n,sizeof(int),asc);
    qsort(even,n,sizeof(int),asc);

    block* b_odd;
    block* b_even;
    NEW(b_odd,n);
    NEW(b_even,n);
    for(int i=0;i<n;i++){
        b_odd[i].n=-1;
        b_even[i].n=-1;
    }
    array_blocked_3(odd,n,b_odd);
    array_blocked_3(even,n,b_even);

    int odd_block_num=0;
    int even_block_num=0;
    for(int i=0;i<n;i++){
        if(b_odd[i].n==-1) break;
        else odd_block_num++;
    }
    for(int i=0;i<n;i++){
        if(b_even[i].n==-1) break;
        else even_block_num++;
    }
    qsort(b_odd,odd_block_num,sizeof(block),block_asc);
    qsort(b_even,even_block_num,sizeof(block),block_asc);

    int ans;
    if(b_odd[0].c!=b_even[0].c) ans=N-(b_odd[0].n+b_even[0].n);
    else{
        if(b_odd[1].n==-1 && b_even[1].n==-1) ans=n;
        else if(b_odd[1].n==-1 && b_even[1].n!=-1) ans=MIN(N-(b_even[0].n),N-(b_odd[0].n+b_even[1].n));
        else if(b_odd[1].n!=-1 && b_even[1].n==-1) ans=MIN(N-(b_odd[0].n),N-(b_odd[1].n+b_even[0].n));
        else ans=MIN(N-(b_odd[1].n+b_even[0].n),N-(b_odd[0].n+b_even[1].n));
    }
    printf("%d\n",ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	array_blocked_3
	.type	array_blocked_3, @function
array_blocked_3:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	%rdx, -40(%rbp)
	movl	$0, -12(%rbp)
	movl	$1, -8(%rbp)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, 8(%rax)
	movl	$1, -4(%rbp)
	jmp	.L2
.L5:
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L3
	addl	$1, -8(%rbp)
	jmp	.L4
.L3:
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, 4(%rdx)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-4(%rbp), %edx
	subl	$1, %edx
	movl	%edx, 12(%rax)
	addl	$1, -12(%rbp)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, 8(%rdx)
	movl	$1, -8(%rbp)
.L4:
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L5
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, 4(%rdx)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-28(%rbp), %edx
	subl	$1, %edx
	movl	%edx, 12(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	array_blocked_3, .-array_blocked_3
	.globl	asc
	.type	asc, @function
asc:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	asc, .-asc
	.globl	block_asc
	.type	block_asc, @function
block_asc:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movq	%rsi, -48(%rbp)
	movq	-40(%rbp), %rax
	movq	8(%rax), %rdx
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movq	%rdx, -24(%rbp)
	movq	-48(%rbp), %rax
	movq	8(%rax), %rdx
	movq	(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	%rdx, -8(%rbp)
	movl	-16(%rbp), %eax
	movl	-32(%rbp), %edx
	subl	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	block_asc, .-block_asc
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-76(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -44(%rbp)
	movl	-44(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	cmpq	$0, -40(%rbp)
	jne	.L12
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L12:
	movl	-44(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	cmpq	$0, -32(%rbp)
	jne	.L13
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L13:
	movl	$0, -72(%rbp)
	jmp	.L14
.L15:
	movl	-72(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-72(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -72(%rbp)
.L14:
	movl	-72(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L15
	movl	-44(%rbp), %eax
	movslq	%eax, %rsi
	movq	-40(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-44(%rbp), %eax
	movslq	%eax, %rsi
	movq	-32(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-44(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	cmpq	$0, -24(%rbp)
	jne	.L16
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L16:
	movl	-44(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L17
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L17:
	movl	$0, -68(%rbp)
	jmp	.L18
.L19:
	movl	-68(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	movl	-68(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -68(%rbp)
.L18:
	movl	-68(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L19
	movq	-24(%rbp), %rdx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	array_blocked_3
	movq	-16(%rbp), %rdx
	movl	-44(%rbp), %ecx
	movq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	array_blocked_3
	movl	$0, -64(%rbp)
	movl	$0, -60(%rbp)
	movl	$0, -56(%rbp)
	jmp	.L20
.L23:
	movl	-56(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L41
	addl	$1, -64(%rbp)
	addl	$1, -56(%rbp)
.L20:
	movl	-56(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L23
	jmp	.L22
.L41:
	nop
.L22:
	movl	$0, -52(%rbp)
	jmp	.L24
.L27:
	movl	-52(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L42
	addl	$1, -60(%rbp)
	addl	$1, -52(%rbp)
.L24:
	movl	-52(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L27
	jmp	.L26
.L42:
	nop
.L26:
	movl	-64(%rbp), %eax
	movslq	%eax, %rsi
	movq	-24(%rbp), %rax
	leaq	block_asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-60(%rbp), %eax
	movslq	%eax, %rsi
	movq	-16(%rbp), %rax
	leaq	block_asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movq	-24(%rbp), %rax
	movl	4(%rax), %edx
	movq	-16(%rbp), %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	je	.L28
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -48(%rbp)
	jmp	.L29
.L28:
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L30
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L30
	movl	-44(%rbp), %eax
	movl	%eax, -48(%rbp)
	jmp	.L29
.L30:
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L31
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L31
	movq	-24(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L32
	movl	-76(%rbp), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	jmp	.L33
.L32:
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
.L33:
	movl	%eax, -48(%rbp)
	jmp	.L29
.L31:
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L34
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L34
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L35
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	jmp	.L36
.L35:
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
.L36:
	movl	%eax, -48(%rbp)
	jmp	.L29
.L34:
	movq	-24(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%ecx, %eax
	cmpl	%eax, %edx
	jge	.L37
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	jmp	.L38
.L37:
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
.L38:
	movl	%eax, -48(%rbp)
.L29:
	movl	-48(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L40
	call	__stack_chk_fail@PLT
.L40:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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
	.globl	array_blocked_3
	.type	array_blocked_3, @function
array_blocked_3:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	%rdx, -40(%rbp)
	movl	$0, -12(%rbp)
	movl	$1, -8(%rbp)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, 8(%rax)
	movl	$1, -4(%rbp)
	jmp	.L2
.L5:
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L3
	addl	$1, -8(%rbp)
	jmp	.L4
.L3:
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, 4(%rdx)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-4(%rbp), %edx
	subl	$1, %edx
	movl	%edx, 12(%rax)
	addl	$1, -12(%rbp)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, 8(%rdx)
	movl	$1, -8(%rbp)
.L4:
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L5
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, 4(%rdx)
	movl	-12(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-28(%rbp), %edx
	subl	$1, %edx
	movl	%edx, 12(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	array_blocked_3, .-array_blocked_3
	.globl	asc
	.type	asc, @function
asc:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	asc, .-asc
	.globl	block_asc
	.type	block_asc, @function
block_asc:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movq	%rsi, -48(%rbp)
	movq	-40(%rbp), %rax
	movq	8(%rax), %rdx
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movq	%rdx, -24(%rbp)
	movq	-48(%rbp), %rax
	movq	8(%rax), %rdx
	movq	(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	%rdx, -8(%rbp)
	movl	-16(%rbp), %eax
	movl	-32(%rbp), %edx
	subl	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	block_asc, .-block_asc
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-76(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -44(%rbp)
	movl	-44(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	cmpq	$0, -40(%rbp)
	jne	.L12
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L12:
	movl	-44(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	cmpq	$0, -32(%rbp)
	jne	.L13
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L13:
	movl	$0, -72(%rbp)
	jmp	.L14
.L15:
	movl	-72(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-72(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -72(%rbp)
.L14:
	movl	-72(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L15
	movl	-44(%rbp), %eax
	movslq	%eax, %rsi
	movq	-40(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-44(%rbp), %eax
	movslq	%eax, %rsi
	movq	-32(%rbp), %rax
	leaq	asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-44(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	cmpq	$0, -24(%rbp)
	jne	.L16
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L16:
	movl	-44(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L17
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L17:
	movl	$0, -68(%rbp)
	jmp	.L18
.L19:
	movl	-68(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	movl	-68(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -68(%rbp)
.L18:
	movl	-68(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L19
	movq	-24(%rbp), %rdx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	array_blocked_3
	movq	-16(%rbp), %rdx
	movl	-44(%rbp), %ecx
	movq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	array_blocked_3
	movl	$0, -64(%rbp)
	movl	$0, -60(%rbp)
	movl	$0, -56(%rbp)
	jmp	.L20
.L23:
	movl	-56(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L41
	addl	$1, -64(%rbp)
	addl	$1, -56(%rbp)
.L20:
	movl	-56(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L23
	jmp	.L22
.L41:
	nop
.L22:
	movl	$0, -52(%rbp)
	jmp	.L24
.L27:
	movl	-52(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L42
	addl	$1, -60(%rbp)
	addl	$1, -52(%rbp)
.L24:
	movl	-52(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L27
	jmp	.L26
.L42:
	nop
.L26:
	movl	-64(%rbp), %eax
	movslq	%eax, %rsi
	movq	-24(%rbp), %rax
	leaq	block_asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-60(%rbp), %eax
	movslq	%eax, %rsi
	movq	-16(%rbp), %rax
	leaq	block_asc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movq	-24(%rbp), %rax
	movl	4(%rax), %edx
	movq	-16(%rbp), %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	je	.L28
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -48(%rbp)
	jmp	.L29
.L28:
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L30
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L30
	movl	-44(%rbp), %eax
	movl	%eax, -48(%rbp)
	jmp	.L29
.L30:
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L31
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L31
	movq	-24(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L32
	movl	-76(%rbp), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	jmp	.L33
.L32:
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
.L33:
	movl	%eax, -48(%rbp)
	jmp	.L29
.L31:
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L34
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L34
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L35
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	jmp	.L36
.L35:
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
.L36:
	movl	%eax, -48(%rbp)
	jmp	.L29
.L34:
	movq	-24(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%ecx, %eax
	cmpl	%eax, %edx
	jge	.L37
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	jmp	.L38
.L37:
	movl	-76(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	addq	$16, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
.L38:
	movl	%eax, -48(%rbp)
.L29:
	movl	-48(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L40
	call	__stack_chk_fail@PLT
.L40:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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:
