Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main() {
	int N;
	scanf("%d", &N);
	int *A = (int *)malloc(sizeof(int)*N);
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &A[i]);
	}

	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		ans++;
		while (A[i] == A[i + 1] && i + 1 < N)
		{
			i++;
		}
		if (A[i] - A[i + 1] > 0)
		{
			while (A[i] - A[i + 1] >= 0 && i + 1 < N)
			{
				i++;
			}
		}
		else
		{
			while (A[i] - A[i + 1] <= 0 && i + 1 < N)
			{
				i++;
			}
		}
	}
	printf("%d\n", ans);

	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rdi
	movq	%rdi, %r14
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	movq	%rax, %r12
	testl	%r14d, %r14d
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	addq	$4, %r12
	cmpl	%ebp, %ecx
	jg	.L4
	testl	%ecx, %ecx
	jle	.L5
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%edx, %rax
	addl	$1, %r8d
	movl	(%rbx,%rax,4), %edi
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L24:
	addq	$1, %rax
	cmpl	%eax, %ecx
	jle	.L8
.L7:
	movl	4(%rbx,%rax,4), %esi
	movl	%eax, %edx
	cmpl	%edi, %esi
	je	.L24
	cmpl	%esi, %edi
	jle	.L8
	addl	$1, %edx
	movslq	%edx, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%eax, %edx
	cmpl	%eax, %ecx
	jle	.L3
	movl	(%rbx,%rax,4), %esi
	subl	4(%rbx,%rax,4), %esi
	addq	$1, %rax
	testl	%esi, %esi
	jns	.L9
	addl	$1, %edx
.L12:
	cmpl	%edx, %ecx
	jg	.L14
	.p2align 4,,10
	.p2align 3
.L3:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	movslq	%edx, %rax
	leaq	(%rbx,%rax,4), %rax
	movl	(%rax), %esi
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%esi, %edi
	movl	4(%rax), %esi
	addl	$1, %edx
	cmpl	%esi, %edi
	jg	.L12
	addq	$4, %rax
	cmpl	%edx, %ecx
	jg	.L13
	jmp	.L3
.L5:
	xorl	%r8d, %r8d
	jmp	.L3
.L25:
	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:
```

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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rdi
	movq	%rdi, %r14
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	movq	%rax, %r12
	testl	%r14d, %r14d
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	addq	$4, %r12
	cmpl	%ebp, %ecx
	jg	.L4
	testl	%ecx, %ecx
	jle	.L5
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%edx, %rax
	addl	$1, %r8d
	movl	(%rbx,%rax,4), %edi
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L24:
	addq	$1, %rax
	cmpl	%eax, %ecx
	jle	.L8
.L7:
	movl	4(%rbx,%rax,4), %esi
	movl	%eax, %edx
	cmpl	%edi, %esi
	je	.L24
	cmpl	%esi, %edi
	jle	.L8
	addl	$1, %edx
	movslq	%edx, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%eax, %edx
	cmpl	%eax, %ecx
	jle	.L3
	movl	(%rbx,%rax,4), %esi
	subl	4(%rbx,%rax,4), %esi
	addq	$1, %rax
	testl	%esi, %esi
	jns	.L9
	addl	$1, %edx
.L12:
	cmpl	%edx, %ecx
	jg	.L14
	.p2align 4,,10
	.p2align 3
.L3:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	movslq	%edx, %rax
	leaq	(%rbx,%rax,4), %rax
	movl	(%rax), %esi
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%esi, %edi
	movl	4(%rax), %esi
	addl	$1, %edx
	cmpl	%esi, %edi
	jg	.L12
	addq	$4, %rax
	cmpl	%edx, %ecx
	jg	.L13
	jmp	.L3
.L5:
	xorl	%r8d, %r8d
	jmp	.L3
.L25:
	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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rdi
	movq	%rdi, %r14
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	movq	%rax, %r12
	testl	%r14d, %r14d
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	addq	$4, %r12
	cmpl	%ebp, %ecx
	jg	.L4
	testl	%ecx, %ecx
	jle	.L5
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%edx, %rax
	addl	$1, %r8d
	movl	(%rbx,%rax,4), %edi
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L24:
	addq	$1, %rax
	cmpl	%eax, %ecx
	jle	.L8
.L7:
	movl	4(%rbx,%rax,4), %esi
	movl	%eax, %edx
	cmpl	%edi, %esi
	je	.L24
	cmpl	%esi, %edi
	jle	.L8
	addl	$1, %edx
	movslq	%edx, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%eax, %edx
	cmpl	%eax, %ecx
	jle	.L3
	movl	(%rbx,%rax,4), %esi
	subl	4(%rbx,%rax,4), %esi
	addq	$1, %rax
	testl	%esi, %esi
	jns	.L9
	addl	$1, %edx
.L12:
	cmpl	%edx, %ecx
	jg	.L14
	.p2align 4,,10
	.p2align 3
.L3:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	movslq	%edx, %rax
	leaq	(%rbx,%rax,4), %rax
	movl	(%rax), %esi
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%esi, %edi
	movl	4(%rax), %esi
	addl	$1, %edx
	cmpl	%esi, %edi
	jg	.L12
	addq	$4, %rax
	cmpl	%edx, %ecx
	jg	.L13
	jmp	.L3
.L5:
	xorl	%r8d, %r8d
	jmp	.L3
.L25:
	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:
```
```c
#include<stdio.h>
int main() {
	int N;
	scanf("%d", &N);
	int *A = (int *)malloc(sizeof(int)*N);
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &A[i]);
	}

	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		ans++;
		while (A[i] == A[i + 1] && i + 1 < N)
		{
			i++;
		}
		if (A[i] - A[i + 1] > 0)
		{
			while (A[i] - A[i + 1] >= 0 && i + 1 < N)
			{
				i++;
			}
		}
		else
		{
			while (A[i] - A[i + 1] <= 0 && i + 1 < N)
			{
				i++;
			}
		}
	}
	printf("%d\n", ans);

	return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main() {
	int N;
	scanf("%d", &N);
	int *A = (int *)malloc(sizeof(int)*N);
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &A[i]);
	}

	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		ans++;
		while (A[i] == A[i + 1] && i + 1 < N)
		{
			i++;
		}
		if (A[i] - A[i + 1] > 0)
		{
			while (A[i] - A[i + 1] >= 0 && i + 1 < N)
			{
				i++;
			}
		}
		else
		{
			while (A[i] - A[i + 1] <= 0 && i + 1 < N)
			{
				i++;
			}
		}
	}
	printf("%d\n", ans);

	return 0;
}```

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.
Optimized Assembly Code:

6
1 2 3 2 0 1
 9
1 2 1 2 2 2 1 2 1
 6
1 2 3 2 0 0
 9
0 1 0 -1 2 7 2 -1 0
 7
1 2 3 2 1 999999999 1000000100
 9
1 2 1 2 2 2 2 2 1
 7
1 4 3 2 1 999999999 1000000100
 6
0 2 3 2 0 0
 9
1 2 0 2 2 2 2 2 1
 7
1 4 3 4 1 999999999 1000000100

3
 4
 2
 5
 3
 3
 3
 2
 3
 3

Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main() {
	int N;
	scanf("%d", &N);
	int *A = (int *)malloc(sizeof(int)*N);
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &A[i]);
	}

	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		ans++;
		while (A[i] == A[i + 1] && i + 1 < N)
		{
			i++;
		}
		if (A[i] - A[i + 1] > 0)
		{
			while (A[i] - A[i + 1] >= 0 && i + 1 < N)
			{
				i++;
			}
		}
		else
		{
			while (A[i] - A[i + 1] <= 0 && i + 1 < N)
			{
				i++;
			}
		}
	}
	printf("%d\n", ans);

	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rdi
	movq	%rdi, %r14
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	movq	%rax, %r12
	testl	%r14d, %r14d
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	addq	$4, %r12
	cmpl	%ebp, %ecx
	jg	.L4
	testl	%ecx, %ecx
	jle	.L5
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%edx, %rax
	addl	$1, %r8d
	movl	(%rbx,%rax,4), %edi
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L24:
	addq	$1, %rax
	cmpl	%eax, %ecx
	jle	.L8
.L7:
	movl	4(%rbx,%rax,4), %esi
	movl	%eax, %edx
	cmpl	%edi, %esi
	je	.L24
	cmpl	%esi, %edi
	jle	.L8
	addl	$1, %edx
	movslq	%edx, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%eax, %edx
	cmpl	%eax, %ecx
	jle	.L3
	movl	(%rbx,%rax,4), %esi
	subl	4(%rbx,%rax,4), %esi
	addq	$1, %rax
	testl	%esi, %esi
	jns	.L9
	addl	$1, %edx
.L12:
	cmpl	%edx, %ecx
	jg	.L14
	.p2align 4,,10
	.p2align 3
.L3:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	movslq	%edx, %rax
	leaq	(%rbx,%rax,4), %rax
	movl	(%rax), %esi
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%esi, %edi
	movl	4(%rax), %esi
	addl	$1, %edx
	cmpl	%esi, %edi
	jg	.L12
	addq	$4, %rax
	cmpl	%edx, %ecx
	jg	.L13
	jmp	.L3
.L5:
	xorl	%r8d, %r8d
	jmp	.L3
.L25:
	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:
```

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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rdi
	movq	%rdi, %r14
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	movq	%rax, %r12
	testl	%r14d, %r14d
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	addq	$4, %r12
	cmpl	%ebp, %ecx
	jg	.L4
	testl	%ecx, %ecx
	jle	.L5
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%edx, %rax
	addl	$1, %r8d
	movl	(%rbx,%rax,4), %edi
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L24:
	addq	$1, %rax
	cmpl	%eax, %ecx
	jle	.L8
.L7:
	movl	4(%rbx,%rax,4), %esi
	movl	%eax, %edx
	cmpl	%edi, %esi
	je	.L24
	cmpl	%esi, %edi
	jle	.L8
	addl	$1, %edx
	movslq	%edx, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%eax, %edx
	cmpl	%eax, %ecx
	jle	.L3
	movl	(%rbx,%rax,4), %esi
	subl	4(%rbx,%rax,4), %esi
	addq	$1, %rax
	testl	%esi, %esi
	jns	.L9
	addl	$1, %edx
.L12:
	cmpl	%edx, %ecx
	jg	.L14
	.p2align 4,,10
	.p2align 3
.L3:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	movslq	%edx, %rax
	leaq	(%rbx,%rax,4), %rax
	movl	(%rax), %esi
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%esi, %edi
	movl	4(%rax), %esi
	addl	$1, %edx
	cmpl	%esi, %edi
	jg	.L12
	addq	$4, %rax
	cmpl	%edx, %ecx
	jg	.L13
	jmp	.L3
.L5:
	xorl	%r8d, %r8d
	jmp	.L3
.L25:
	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:
```