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

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

int calc(void){
  int n;
  scanf("%d",&n);
  int *cnt=(int *)calloc(n,sizeof(int));
  int kind=0;
  int min=n;
  int i;
  for(i=0;i<n;i++){
    int a;
    scanf("%d",&a);
    if(cnt[a]==0) kind++;
    cnt[a]++;
    min=MIN(min,a);
  }
  if(kind>2) return 0;
  if(kind==1){
    return min==n-1 || 2*min<=n;
  }
  if(cnt[min]+cnt[min+1]<n) return 0;
  int one=cnt[min];
  int two=cnt[min+1];
  if(min+1<one+1 || two<2 || min+1>one+two/2) return 0;
  return 1;
}

void run(void){
  puts(calc()?"Yes":"No");
}

int main(void){
  run();
  return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB39:
	.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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movslq	(%rsp), %rbx
	movl	$4, %esi
	movq	%rbx, %rdi
	movq	%rbx, %r14
	call	calloc@PLT
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L11
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	leaq	4(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	leaq	0(%rbp,%rax,4), %rcx
	movq	%rax, %rdx
	movl	(%rcx), %eax
	cmpl	$1, %eax
	adcl	$0, %ebx
	addl	$1, %eax
	cmpl	%edx, %r14d
	movl	%eax, (%rcx)
	movl	(%rsp), %eax
	cmovg	%edx, %r14d
	addl	$1, %r15d
	cmpl	%r15d, %eax
	jg	.L4
	cmpl	$2, %ebx
	jg	.L9
	cmpl	$1, %ebx
	je	.L7
	movslq	%r14d, %rbx
.L2:
	movl	0(%rbp,%rbx,4), %ecx
	movl	4(%rbp,%rbx,4), %edx
	leal	(%rcx,%rdx), %esi
	cmpl	%eax, %esi
	jl	.L9
	cmpl	%r14d, %ecx
	jg	.L9
	cmpl	$1, %edx
	jle	.L9
	sarl	%edx
	addl	%ecx, %edx
	cmpl	%r14d, %edx
	jle	.L9
.L8:
	movl	$1, %eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L9:
	xorl	%eax, %eax
.L1:
	movq	8(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L15
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	leal	-1(%rax), %edx
	cmpl	%r14d, %edx
	je	.L8
	addl	%r14d, %r14d
	cmpl	%r14d, %eax
	setge	%al
	movzbl	%al, %eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%ebx, %eax
	jmp	.L2
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	calc, .-calc
	.section	.rodata.str1.1
.LC1:
	.string	"Yes"
.LC2:
	.string	"No"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	calc
	leaq	.LC1(%rip), %rdi
	testl	%eax, %eax
	leaq	.LC2(%rip), %rax
	cmove	%rax, %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	jmp	puts@PLT
	.cfi_endproc
.LFE40:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.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"
	.text
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB39:
	.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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movslq	(%rsp), %rbx
	movl	$4, %esi
	movq	%rbx, %rdi
	movq	%rbx, %r14
	call	calloc@PLT
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L11
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	leaq	4(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	leaq	0(%rbp,%rax,4), %rcx
	movq	%rax, %rdx
	movl	(%rcx), %eax
	cmpl	$1, %eax
	adcl	$0, %ebx
	addl	$1, %eax
	cmpl	%edx, %r14d
	movl	%eax, (%rcx)
	movl	(%rsp), %eax
	cmovg	%edx, %r14d
	addl	$1, %r15d
	cmpl	%r15d, %eax
	jg	.L4
	cmpl	$2, %ebx
	jg	.L9
	cmpl	$1, %ebx
	je	.L7
	movslq	%r14d, %rbx
.L2:
	movl	0(%rbp,%rbx,4), %ecx
	movl	4(%rbp,%rbx,4), %edx
	leal	(%rcx,%rdx), %esi
	cmpl	%eax, %esi
	jl	.L9
	cmpl	%r14d, %ecx
	jg	.L9
	cmpl	$1, %edx
	jle	.L9
	sarl	%edx
	addl	%ecx, %edx
	cmpl	%r14d, %edx
	jle	.L9
.L8:
	movl	$1, %eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L9:
	xorl	%eax, %eax
.L1:
	movq	8(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L15
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	leal	-1(%rax), %edx
	cmpl	%r14d, %edx
	je	.L8
	addl	%r14d, %r14d
	cmpl	%r14d, %eax
	setge	%al
	movzbl	%al, %eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%ebx, %eax
	jmp	.L2
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	calc, .-calc
	.section	.rodata.str1.1
.LC1:
	.string	"Yes"
.LC2:
	.string	"No"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	calc
	leaq	.LC1(%rip), %rdi
	testl	%eax, %eax
	leaq	.LC2(%rip), %rax
	cmove	%rax, %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	jmp	puts@PLT
	.cfi_endproc
.LFE40:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.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"
	.text
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB39:
	.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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movslq	(%rsp), %rbx
	movl	$4, %esi
	movq	%rbx, %rdi
	movq	%rbx, %r14
	call	calloc@PLT
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L11
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	leaq	4(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	leaq	0(%rbp,%rax,4), %rcx
	movq	%rax, %rdx
	movl	(%rcx), %eax
	cmpl	$1, %eax
	adcl	$0, %ebx
	addl	$1, %eax
	cmpl	%edx, %r14d
	movl	%eax, (%rcx)
	movl	(%rsp), %eax
	cmovg	%edx, %r14d
	addl	$1, %r15d
	cmpl	%r15d, %eax
	jg	.L4
	cmpl	$2, %ebx
	jg	.L9
	cmpl	$1, %ebx
	je	.L7
	movslq	%r14d, %rbx
.L2:
	movl	0(%rbp,%rbx,4), %ecx
	movl	4(%rbp,%rbx,4), %edx
	leal	(%rcx,%rdx), %esi
	cmpl	%eax, %esi
	jl	.L9
	cmpl	%r14d, %ecx
	jg	.L9
	cmpl	$1, %edx
	jle	.L9
	sarl	%edx
	addl	%ecx, %edx
	cmpl	%r14d, %edx
	jle	.L9
.L8:
	movl	$1, %eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L9:
	xorl	%eax, %eax
.L1:
	movq	8(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L15
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	leal	-1(%rax), %edx
	cmpl	%r14d, %edx
	je	.L8
	addl	%r14d, %r14d
	cmpl	%r14d, %eax
	setge	%al
	movzbl	%al, %eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%ebx, %eax
	jmp	.L2
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	calc, .-calc
	.section	.rodata.str1.1
.LC1:
	.string	"Yes"
.LC2:
	.string	"No"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	calc
	leaq	.LC1(%rip), %rdi
	testl	%eax, %eax
	leaq	.LC2(%rip), %rax
	cmove	%rax, %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	jmp	puts@PLT
	.cfi_endproc
.LFE40:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.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>
#include<stdlib.h>

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

int calc(void){
  int n;
  scanf("%d",&n);
  int *cnt=(int *)calloc(n,sizeof(int));
  int kind=0;
  int min=n;
  int i;
  for(i=0;i<n;i++){
    int a;
    scanf("%d",&a);
    if(cnt[a]==0) kind++;
    cnt[a]++;
    min=MIN(min,a);
  }
  if(kind>2) return 0;
  if(kind==1){
    return min==n-1 || 2*min<=n;
  }
  if(cnt[min]+cnt[min+1]<n) return 0;
  int one=cnt[min];
  int two=cnt[min+1];
  if(min+1<one+1 || two<2 || min+1>one+two/2) return 0;
  return 1;
}

void run(void){
  puts(calc()?"Yes":"No");
}

int main(void){
  run();
  return 0;
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#include<stdlib.h>

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

int calc(void){
  int n;
  scanf("%d",&n);
  int *cnt=(int *)calloc(n,sizeof(int));
  int kind=0;
  int min=n;
  int i;
  for(i=0;i<n;i++){
    int a;
    scanf("%d",&a);
    if(cnt[a]==0) kind++;
    cnt[a]++;
    min=MIN(min,a);
  }
  if(kind>2) return 0;
  if(kind==1){
    return min==n-1 || 2*min<=n;
  }
  if(cnt[min]+cnt[min+1]<n) return 0;
  int one=cnt[min];
  int two=cnt[min+1];
  if(min+1<one+1 || two<2 || min+1>one+two/2) return 0;
  return 1;
}

void run(void){
  puts(calc()?"Yes":"No");
}

int main(void){
  run();
  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:

3
1 1 3
 5
3 4 3 4 3
 5
3 4 3 3 3
 3
0 2 2
 4
2 4 2 2
 3
4 2 2
 3
1 0 3
 3
0 2 4
 4
2 4 4 2
 3
4 0 2

No
 Yes
 No
 No
 No
 No
 No
 No
 No
 No

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

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

int calc(void){
  int n;
  scanf("%d",&n);
  int *cnt=(int *)calloc(n,sizeof(int));
  int kind=0;
  int min=n;
  int i;
  for(i=0;i<n;i++){
    int a;
    scanf("%d",&a);
    if(cnt[a]==0) kind++;
    cnt[a]++;
    min=MIN(min,a);
  }
  if(kind>2) return 0;
  if(kind==1){
    return min==n-1 || 2*min<=n;
  }
  if(cnt[min]+cnt[min+1]<n) return 0;
  int one=cnt[min];
  int two=cnt[min+1];
  if(min+1<one+1 || two<2 || min+1>one+two/2) return 0;
  return 1;
}

void run(void){
  puts(calc()?"Yes":"No");
}

int main(void){
  run();
  return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB39:
	.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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movslq	(%rsp), %rbx
	movl	$4, %esi
	movq	%rbx, %rdi
	movq	%rbx, %r14
	call	calloc@PLT
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L11
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	leaq	4(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	leaq	0(%rbp,%rax,4), %rcx
	movq	%rax, %rdx
	movl	(%rcx), %eax
	cmpl	$1, %eax
	adcl	$0, %ebx
	addl	$1, %eax
	cmpl	%edx, %r14d
	movl	%eax, (%rcx)
	movl	(%rsp), %eax
	cmovg	%edx, %r14d
	addl	$1, %r15d
	cmpl	%r15d, %eax
	jg	.L4
	cmpl	$2, %ebx
	jg	.L9
	cmpl	$1, %ebx
	je	.L7
	movslq	%r14d, %rbx
.L2:
	movl	0(%rbp,%rbx,4), %ecx
	movl	4(%rbp,%rbx,4), %edx
	leal	(%rcx,%rdx), %esi
	cmpl	%eax, %esi
	jl	.L9
	cmpl	%r14d, %ecx
	jg	.L9
	cmpl	$1, %edx
	jle	.L9
	sarl	%edx
	addl	%ecx, %edx
	cmpl	%r14d, %edx
	jle	.L9
.L8:
	movl	$1, %eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L9:
	xorl	%eax, %eax
.L1:
	movq	8(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L15
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	leal	-1(%rax), %edx
	cmpl	%r14d, %edx
	je	.L8
	addl	%r14d, %r14d
	cmpl	%r14d, %eax
	setge	%al
	movzbl	%al, %eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%ebx, %eax
	jmp	.L2
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	calc, .-calc
	.section	.rodata.str1.1
.LC1:
	.string	"Yes"
.LC2:
	.string	"No"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	calc
	leaq	.LC1(%rip), %rdi
	testl	%eax, %eax
	leaq	.LC2(%rip), %rax
	cmove	%rax, %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	jmp	puts@PLT
	.cfi_endproc
.LFE40:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.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"
	.text
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB39:
	.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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movslq	(%rsp), %rbx
	movl	$4, %esi
	movq	%rbx, %rdi
	movq	%rbx, %r14
	call	calloc@PLT
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L11
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	leaq	4(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	leaq	0(%rbp,%rax,4), %rcx
	movq	%rax, %rdx
	movl	(%rcx), %eax
	cmpl	$1, %eax
	adcl	$0, %ebx
	addl	$1, %eax
	cmpl	%edx, %r14d
	movl	%eax, (%rcx)
	movl	(%rsp), %eax
	cmovg	%edx, %r14d
	addl	$1, %r15d
	cmpl	%r15d, %eax
	jg	.L4
	cmpl	$2, %ebx
	jg	.L9
	cmpl	$1, %ebx
	je	.L7
	movslq	%r14d, %rbx
.L2:
	movl	0(%rbp,%rbx,4), %ecx
	movl	4(%rbp,%rbx,4), %edx
	leal	(%rcx,%rdx), %esi
	cmpl	%eax, %esi
	jl	.L9
	cmpl	%r14d, %ecx
	jg	.L9
	cmpl	$1, %edx
	jle	.L9
	sarl	%edx
	addl	%ecx, %edx
	cmpl	%r14d, %edx
	jle	.L9
.L8:
	movl	$1, %eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L9:
	xorl	%eax, %eax
.L1:
	movq	8(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L15
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	leal	-1(%rax), %edx
	cmpl	%r14d, %edx
	je	.L8
	addl	%r14d, %r14d
	cmpl	%r14d, %eax
	setge	%al
	movzbl	%al, %eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%ebx, %eax
	jmp	.L2
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	calc, .-calc
	.section	.rodata.str1.1
.LC1:
	.string	"Yes"
.LC2:
	.string	"No"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	calc
	leaq	.LC1(%rip), %rdi
	testl	%eax, %eax
	leaq	.LC2(%rip), %rax
	cmove	%rax, %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	jmp	puts@PLT
	.cfi_endproc
.LFE40:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.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:
```