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>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)>(b)?(b):(a))
int c(int n){
	if(!n)return 0;
	return c(n>>1)+(n&1);
}
int N, K, a[20];
long long ans=1ll<<60;
int main(){
	scanf("%d%d",&N,&K);
	for(int i=0; i<N; i++)scanf("%d",&a[i]);
	for(int i=0; i<(1<<N-1); i++)if(c(i)>=K-1){
		int maxi=a[0];
		long sum=0;
		for(int j=1; j<N; j++){
			if((i>>j-1)&1){
				if(a[j] <= maxi){
					sum += maxi-a[j]+1;
					maxi++;
				}else {
					maxi = a[j];
				}
			}else {
				maxi = max(maxi,a[j]);
			}
		}
		ans = min(ans,sum);
	}
	printf("%lld\n",ans);
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	c
	.type	c, @function
c:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	testl	%edi, %edi
	je	.L1
	.p2align 4,,10
	.p2align 3
.L2:
	movl	%edi, %eax
	andl	$1, %eax
	addl	%eax, %r8d
	sarl	%edi
	jne	.L2
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	c, .-c
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	K(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	__isoc99_scanf@PLT
	movl	N(%rip), %r8d
	testl	%r8d, %r8d
	jle	.L11
	leaq	a(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	N(%rip), %r8d
	addq	$4, %rbp
	cmpl	%ebx, %r8d
	jg	.L12
.L11:
	movq	ans(%rip), %r12
	leal	-1(%r8), %ecx
	movl	$1, %r10d
	sall	%cl, %r10d
	movq	%r12, %rbx
	testl	%r10d, %r10d
	jle	.L13
	movl	K(%rip), %eax
	xorl	%esi, %esi
	movl	a(%rip), %ebp
	xorl	%edi, %edi
	xorl	%r13d, %r13d
	leaq	4+a(%rip), %r9
	leal	-1(%rax), %r11d
	cmpl	%esi, %r11d
	jle	.L33
	.p2align 4,,10
	.p2align 3
.L15:
	addl	$1, %edi
	cmpl	%r10d, %edi
	je	.L34
.L24:
	movl	%edi, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%eax, %edx
	andl	$1, %edx
	addl	%edx, %esi
	sarl	%eax
	jne	.L17
	cmpl	%esi, %r11d
	jg	.L15
.L33:
	cmpl	$1, %r8d
	jle	.L22
	movl	%ebp, %edx
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L35:
	cmpl	%edx, %esi
	jg	.L23
	movl	%edx, %r14d
	addl	$1, %edx
	subl	%esi, %r14d
	leal	1(%r14), %esi
	movslq	%esi, %rsi
	addq	%rsi, %r13
.L20:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L18
.L21:
	btl	%eax, %edi
	movl	(%r9,%rax,4), %esi
	jc	.L35
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L21
.L18:
	cmpq	%r13, %rbx
	cmovg	%r13, %rbx
	addl	$1, %edi
	movl	$1, %r13d
	cmpl	%r10d, %edi
	jne	.L24
.L34:
	testb	%r13b, %r13b
	je	.L13
	movq	%rbx, ans(%rip)
	movq	%rbx, %r12
.L13:
	movq	%r12, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.L23:
	.cfi_restore_state
	movl	%esi, %edx
	jmp	.L20
.L22:
	xorl	%r13d, %r13d
	jmp	.L18
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	ans
	.data
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.quad	1152921504606846976
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	K
	.align 4
	.type	K, @object
	.size	K, 4
K:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	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:
```

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
	.p2align 4
	.globl	c
	.type	c, @function
c:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	testl	%edi, %edi
	je	.L1
	.p2align 4,,10
	.p2align 3
.L2:
	movl	%edi, %eax
	andl	$1, %eax
	addl	%eax, %r8d
	sarl	%edi
	jne	.L2
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	c, .-c
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	K(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	__isoc99_scanf@PLT
	movl	N(%rip), %r8d
	testl	%r8d, %r8d
	jle	.L11
	leaq	a(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	N(%rip), %r8d
	addq	$4, %rbp
	cmpl	%ebx, %r8d
	jg	.L12
.L11:
	movq	ans(%rip), %r12
	leal	-1(%r8), %ecx
	movl	$1, %r10d
	sall	%cl, %r10d
	movq	%r12, %rbx
	testl	%r10d, %r10d
	jle	.L13
	movl	K(%rip), %eax
	xorl	%esi, %esi
	movl	a(%rip), %ebp
	xorl	%edi, %edi
	xorl	%r13d, %r13d
	leaq	4+a(%rip), %r9
	leal	-1(%rax), %r11d
	cmpl	%esi, %r11d
	jle	.L33
	.p2align 4,,10
	.p2align 3
.L15:
	addl	$1, %edi
	cmpl	%r10d, %edi
	je	.L34
.L24:
	movl	%edi, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%eax, %edx
	andl	$1, %edx
	addl	%edx, %esi
	sarl	%eax
	jne	.L17
	cmpl	%esi, %r11d
	jg	.L15
.L33:
	cmpl	$1, %r8d
	jle	.L22
	movl	%ebp, %edx
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L35:
	cmpl	%edx, %esi
	jg	.L23
	movl	%edx, %r14d
	addl	$1, %edx
	subl	%esi, %r14d
	leal	1(%r14), %esi
	movslq	%esi, %rsi
	addq	%rsi, %r13
.L20:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L18
.L21:
	btl	%eax, %edi
	movl	(%r9,%rax,4), %esi
	jc	.L35
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L21
.L18:
	cmpq	%r13, %rbx
	cmovg	%r13, %rbx
	addl	$1, %edi
	movl	$1, %r13d
	cmpl	%r10d, %edi
	jne	.L24
.L34:
	testb	%r13b, %r13b
	je	.L13
	movq	%rbx, ans(%rip)
	movq	%rbx, %r12
.L13:
	movq	%r12, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.L23:
	.cfi_restore_state
	movl	%esi, %edx
	jmp	.L20
.L22:
	xorl	%r13d, %r13d
	jmp	.L18
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	ans
	.data
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.quad	1152921504606846976
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	K
	.align 4
	.type	K, @object
	.size	K, 4
K:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	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
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	c
	.type	c, @function
c:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	testl	%edi, %edi
	je	.L1
	.p2align 4,,10
	.p2align 3
.L2:
	movl	%edi, %eax
	andl	$1, %eax
	addl	%eax, %r8d
	sarl	%edi
	jne	.L2
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	c, .-c
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	K(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	__isoc99_scanf@PLT
	movl	N(%rip), %r8d
	testl	%r8d, %r8d
	jle	.L11
	leaq	a(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	N(%rip), %r8d
	addq	$4, %rbp
	cmpl	%ebx, %r8d
	jg	.L12
.L11:
	movq	ans(%rip), %r12
	leal	-1(%r8), %ecx
	movl	$1, %r10d
	sall	%cl, %r10d
	movq	%r12, %rbx
	testl	%r10d, %r10d
	jle	.L13
	movl	K(%rip), %eax
	xorl	%esi, %esi
	movl	a(%rip), %ebp
	xorl	%edi, %edi
	xorl	%r13d, %r13d
	leaq	4+a(%rip), %r9
	leal	-1(%rax), %r11d
	cmpl	%esi, %r11d
	jle	.L33
	.p2align 4,,10
	.p2align 3
.L15:
	addl	$1, %edi
	cmpl	%r10d, %edi
	je	.L34
.L24:
	movl	%edi, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%eax, %edx
	andl	$1, %edx
	addl	%edx, %esi
	sarl	%eax
	jne	.L17
	cmpl	%esi, %r11d
	jg	.L15
.L33:
	cmpl	$1, %r8d
	jle	.L22
	movl	%ebp, %edx
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L35:
	cmpl	%edx, %esi
	jg	.L23
	movl	%edx, %r14d
	addl	$1, %edx
	subl	%esi, %r14d
	leal	1(%r14), %esi
	movslq	%esi, %rsi
	addq	%rsi, %r13
.L20:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L18
.L21:
	btl	%eax, %edi
	movl	(%r9,%rax,4), %esi
	jc	.L35
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L21
.L18:
	cmpq	%r13, %rbx
	cmovg	%r13, %rbx
	addl	$1, %edi
	movl	$1, %r13d
	cmpl	%r10d, %edi
	jne	.L24
.L34:
	testb	%r13b, %r13b
	je	.L13
	movq	%rbx, ans(%rip)
	movq	%rbx, %r12
.L13:
	movq	%r12, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.L23:
	.cfi_restore_state
	movl	%esi, %edx
	jmp	.L20
.L22:
	xorl	%r13d, %r13d
	jmp	.L18
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	ans
	.data
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.quad	1152921504606846976
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	K
	.align 4
	.type	K, @object
	.size	K, 4
K:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	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:
```
```c
#include<stdio.h>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)>(b)?(b):(a))
int c(int n){
	if(!n)return 0;
	return c(n>>1)+(n&1);
}
int N, K, a[20];
long long ans=1ll<<60;
int main(){
	scanf("%d%d",&N,&K);
	for(int i=0; i<N; i++)scanf("%d",&a[i]);
	for(int i=0; i<(1<<N-1); i++)if(c(i)>=K-1){
		int maxi=a[0];
		long sum=0;
		for(int j=1; j<N; j++){
			if((i>>j-1)&1){
				if(a[j] <= maxi){
					sum += maxi-a[j]+1;
					maxi++;
				}else {
					maxi = a[j];
				}
			}else {
				maxi = max(maxi,a[j]);
			}
		}
		ans = min(ans,sum);
	}
	printf("%lld\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>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)>(b)?(b):(a))
int c(int n){
	if(!n)return 0;
	return c(n>>1)+(n&1);
}
int N, K, a[20];
long long ans=1ll<<60;
int main(){
	scanf("%d%d",&N,&K);
	for(int i=0; i<N; i++)scanf("%d",&a[i]);
	for(int i=0; i<(1<<N-1); i++)if(c(i)>=K-1){
		int maxi=a[0];
		long sum=0;
		for(int j=1; j<N; j++){
			if((i>>j-1)&1){
				if(a[j] <= maxi){
					sum += maxi-a[j]+1;
					maxi++;
				}else {
					maxi = a[j];
				}
			}else {
				maxi = max(maxi,a[j]);
			}
		}
		ans = min(ans,sum);
	}
	printf("%lld\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:

5 5
5960 3774 3598 3469 3424
 5 5
3949 3774 4045 3469 3424
 5 5
5960 3774 3598 2384 3424
 5 5
5960 3774 3598 610 3424
 5 5
5960 3170 3598 610 3424
 5 1
5960 3170 3598 610 3424
 5 5
3949 359 3598 3469 3424
 5 5
5960 3774 3598 4173 3424
 5 5
3949 3208 4045 3469 3424
 5 5
5960 3774 6822 2384 3424

9585
 1376
 10670
 12444
 13048
 0
 4956
 8881
 1942
 10026

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>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)>(b)?(b):(a))
int c(int n){
	if(!n)return 0;
	return c(n>>1)+(n&1);
}
int N, K, a[20];
long long ans=1ll<<60;
int main(){
	scanf("%d%d",&N,&K);
	for(int i=0; i<N; i++)scanf("%d",&a[i]);
	for(int i=0; i<(1<<N-1); i++)if(c(i)>=K-1){
		int maxi=a[0];
		long sum=0;
		for(int j=1; j<N; j++){
			if((i>>j-1)&1){
				if(a[j] <= maxi){
					sum += maxi-a[j]+1;
					maxi++;
				}else {
					maxi = a[j];
				}
			}else {
				maxi = max(maxi,a[j]);
			}
		}
		ans = min(ans,sum);
	}
	printf("%lld\n",ans);
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	c
	.type	c, @function
c:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	testl	%edi, %edi
	je	.L1
	.p2align 4,,10
	.p2align 3
.L2:
	movl	%edi, %eax
	andl	$1, %eax
	addl	%eax, %r8d
	sarl	%edi
	jne	.L2
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	c, .-c
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	K(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	__isoc99_scanf@PLT
	movl	N(%rip), %r8d
	testl	%r8d, %r8d
	jle	.L11
	leaq	a(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	N(%rip), %r8d
	addq	$4, %rbp
	cmpl	%ebx, %r8d
	jg	.L12
.L11:
	movq	ans(%rip), %r12
	leal	-1(%r8), %ecx
	movl	$1, %r10d
	sall	%cl, %r10d
	movq	%r12, %rbx
	testl	%r10d, %r10d
	jle	.L13
	movl	K(%rip), %eax
	xorl	%esi, %esi
	movl	a(%rip), %ebp
	xorl	%edi, %edi
	xorl	%r13d, %r13d
	leaq	4+a(%rip), %r9
	leal	-1(%rax), %r11d
	cmpl	%esi, %r11d
	jle	.L33
	.p2align 4,,10
	.p2align 3
.L15:
	addl	$1, %edi
	cmpl	%r10d, %edi
	je	.L34
.L24:
	movl	%edi, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%eax, %edx
	andl	$1, %edx
	addl	%edx, %esi
	sarl	%eax
	jne	.L17
	cmpl	%esi, %r11d
	jg	.L15
.L33:
	cmpl	$1, %r8d
	jle	.L22
	movl	%ebp, %edx
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L35:
	cmpl	%edx, %esi
	jg	.L23
	movl	%edx, %r14d
	addl	$1, %edx
	subl	%esi, %r14d
	leal	1(%r14), %esi
	movslq	%esi, %rsi
	addq	%rsi, %r13
.L20:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L18
.L21:
	btl	%eax, %edi
	movl	(%r9,%rax,4), %esi
	jc	.L35
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L21
.L18:
	cmpq	%r13, %rbx
	cmovg	%r13, %rbx
	addl	$1, %edi
	movl	$1, %r13d
	cmpl	%r10d, %edi
	jne	.L24
.L34:
	testb	%r13b, %r13b
	je	.L13
	movq	%rbx, ans(%rip)
	movq	%rbx, %r12
.L13:
	movq	%r12, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.L23:
	.cfi_restore_state
	movl	%esi, %edx
	jmp	.L20
.L22:
	xorl	%r13d, %r13d
	jmp	.L18
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	ans
	.data
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.quad	1152921504606846976
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	K
	.align 4
	.type	K, @object
	.size	K, 4
K:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	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:
```

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
	.p2align 4
	.globl	c
	.type	c, @function
c:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	testl	%edi, %edi
	je	.L1
	.p2align 4,,10
	.p2align 3
.L2:
	movl	%edi, %eax
	andl	$1, %eax
	addl	%eax, %r8d
	sarl	%edi
	jne	.L2
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	c, .-c
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	K(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	__isoc99_scanf@PLT
	movl	N(%rip), %r8d
	testl	%r8d, %r8d
	jle	.L11
	leaq	a(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	N(%rip), %r8d
	addq	$4, %rbp
	cmpl	%ebx, %r8d
	jg	.L12
.L11:
	movq	ans(%rip), %r12
	leal	-1(%r8), %ecx
	movl	$1, %r10d
	sall	%cl, %r10d
	movq	%r12, %rbx
	testl	%r10d, %r10d
	jle	.L13
	movl	K(%rip), %eax
	xorl	%esi, %esi
	movl	a(%rip), %ebp
	xorl	%edi, %edi
	xorl	%r13d, %r13d
	leaq	4+a(%rip), %r9
	leal	-1(%rax), %r11d
	cmpl	%esi, %r11d
	jle	.L33
	.p2align 4,,10
	.p2align 3
.L15:
	addl	$1, %edi
	cmpl	%r10d, %edi
	je	.L34
.L24:
	movl	%edi, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%eax, %edx
	andl	$1, %edx
	addl	%edx, %esi
	sarl	%eax
	jne	.L17
	cmpl	%esi, %r11d
	jg	.L15
.L33:
	cmpl	$1, %r8d
	jle	.L22
	movl	%ebp, %edx
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L35:
	cmpl	%edx, %esi
	jg	.L23
	movl	%edx, %r14d
	addl	$1, %edx
	subl	%esi, %r14d
	leal	1(%r14), %esi
	movslq	%esi, %rsi
	addq	%rsi, %r13
.L20:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L18
.L21:
	btl	%eax, %edi
	movl	(%r9,%rax,4), %esi
	jc	.L35
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L21
.L18:
	cmpq	%r13, %rbx
	cmovg	%r13, %rbx
	addl	$1, %edi
	movl	$1, %r13d
	cmpl	%r10d, %edi
	jne	.L24
.L34:
	testb	%r13b, %r13b
	je	.L13
	movq	%rbx, ans(%rip)
	movq	%rbx, %r12
.L13:
	movq	%r12, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.L23:
	.cfi_restore_state
	movl	%esi, %edx
	jmp	.L20
.L22:
	xorl	%r13d, %r13d
	jmp	.L18
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	ans
	.data
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.quad	1152921504606846976
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	K
	.align 4
	.type	K, @object
	.size	K, 4
K:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	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:
```