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

```c
#include<stdio.h>
int N, M, k[11], s[11][11], p[11];
int ans = 0;
int main(){
	scanf("%d%d", &N, &M);
	for(int i=0; i<M; i++){
		scanf("%d", k+i);
		for(int j=0; j<k[i]; j++){
			scanf("%d", &s[i][j]);
			s[i][j]--;
		}
	}
	for(int i=0; i<M; i++)scanf("%d", p+i);
	for(int S=0; S<(1<<N); S++){
		int cnt = 0;
		for(int i=0; i<M; i++){
			int P = 0;
			for(int j=0; j<k[i]; j++){
				P ^= (S>>s[i][j])&1;
			}
			cnt += P==p[i];
		}
		ans += cnt==M;
	}
	printf("%d\n", ans);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	k
	.align 32
	.type	k, @object
	.size	k, 44
k:
	.zero	44
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 484
s:
	.zero	484
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 44
p:
	.zero	44
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	leaq	M(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -32(%rbp)
	jmp	.L2
.L5:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L3
.L4:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-28(%rbp), %eax
	movslq	%eax, %rsi
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -28(%rbp)
.L3:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L4
	addl	$1, -32(%rbp)
.L2:
	movl	M(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L5
	movl	$0, -24(%rbp)
	jmp	.L6
.L7:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -24(%rbp)
.L6:
	movl	M(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L7
	movl	$0, -20(%rbp)
	jmp	.L8
.L13:
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L9
.L12:
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	xorl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L10:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	sete	%al
	movzbl	%al, %eax
	addl	%eax, -16(%rbp)
	addl	$1, -12(%rbp)
.L9:
	movl	M(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	movl	M(%rip), %eax
	cmpl	%eax, -16(%rbp)
	sete	%al
	movzbl	%al, %edx
	movl	ans(%rip), %eax
	addl	%edx, %eax
	movl	%eax, ans(%rip)
	addl	$1, -20(%rbp)
.L8:
	movl	N(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cmpl	%eax, -20(%rbp)
	jl	.L13
	movl	ans(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC0(%rip), %rdi
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	movl	M(%rip), %r9d
	testl	%r9d, %r9d
	jle	.L2
	movl	$0, 12(%rsp)
	leaq	k(%rip), %rbp
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	call	__isoc99_scanf@PLT
	movl	0(%rbp), %eax
	leaq	s(%rip), %r14
	subq	%r12, %r14
	testl	%eax, %eax
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	leaq	(%r14,%r12), %rax
	addq	$4, %r14
	subl	$1, (%rax,%rbx)
	cmpl	%r15d, 0(%rbp)
	jg	.L6
.L7:
	addl	$1, 12(%rsp)
	movl	12(%rsp), %eax
	addq	$4, %rbp
	subq	$44, %r12
	movl	M(%rip), %r9d
	addq	$44, %rbx
	cmpl	%eax, %r9d
	jg	.L4
	testl	%r9d, %r9d
	jle	.L2
	leaq	p(%rip), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	M(%rip), %r9d
	addq	$4, %rbp
	cmpl	%ebx, %r9d
	jg	.L8
.L2:
	movl	N(%rip), %ecx
	movl	$1, %r13d
	xorl	%edi, %edi
	movslq	%r9d, %rbp
	movl	ans(%rip), %r12d
	leaq	k(%rip), %rbx
	leaq	p(%rip), %r11
	sall	%cl, %r13d
	testl	%r13d, %r13d
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%r9d, %r9d
	jle	.L18
	leaq	s(%rip), %rdx
	xorl	%r8d, %r8d
	xorl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rbx,%r8,4), %esi
	xorl	%eax, %eax
	testl	%esi, %esi
	jle	.L14
	movl	(%rdx), %ecx
	movl	%edi, %r15d
	sarl	%cl, %r15d
	movl	%r15d, %eax
	andl	$1, %eax
	cmpl	$1, %esi
	je	.L14
	movl	4(%rdx), %ecx
	movl	%edi, %r14d
	sarl	%cl, %r14d
	xorl	%r15d, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$2, %esi
	je	.L14
	movl	8(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$3, %esi
	je	.L14
	movl	12(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$4, %esi
	je	.L14
	movl	16(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$5, %esi
	je	.L14
	movl	20(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$6, %esi
	je	.L14
	movl	24(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$7, %esi
	je	.L14
	movl	28(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$8, %esi
	je	.L14
	movl	32(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$9, %esi
	je	.L14
	movl	36(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$10, %esi
	je	.L14
	movl	40(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%r14d, %eax
	andl	$1, %eax
.L14:
	cmpl	%eax, (%r11,%r8,4)
	sete	%al
	addq	$1, %r8
	addq	$44, %rdx
	movzbl	%al, %eax
	addl	%eax, %r10d
	cmpq	%r8, %rbp
	jne	.L16
.L12:
	xorl	%eax, %eax
	cmpl	%r10d, %r9d
	sete	%al
	addl	$1, %edi
	addl	%eax, %r12d
	cmpl	%r13d, %edi
	jne	.L9
	movl	%r12d, ans(%rip)
.L10:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$24, %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
.L18:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L12
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	ans
	.bss
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 44
p:
	.zero	44
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 484
s:
	.zero	484
	.globl	k
	.align 32
	.type	k, @object
	.size	k, 44
k:
	.zero	44
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.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
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC0(%rip), %rdi
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	movl	M(%rip), %r9d
	testl	%r9d, %r9d
	jle	.L2
	movl	$0, 12(%rsp)
	leaq	k(%rip), %rbp
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	call	__isoc99_scanf@PLT
	movl	0(%rbp), %eax
	leaq	s(%rip), %r14
	subq	%r12, %r14
	testl	%eax, %eax
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	leaq	(%r14,%r12), %rax
	addq	$4, %r14
	subl	$1, (%rax,%rbx)
	cmpl	%r15d, 0(%rbp)
	jg	.L6
.L7:
	addl	$1, 12(%rsp)
	movl	12(%rsp), %eax
	addq	$4, %rbp
	subq	$44, %r12
	movl	M(%rip), %r9d
	addq	$44, %rbx
	cmpl	%eax, %r9d
	jg	.L4
	testl	%r9d, %r9d
	jle	.L2
	leaq	p(%rip), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	M(%rip), %r9d
	addq	$4, %rbp
	cmpl	%ebx, %r9d
	jg	.L8
.L2:
	movl	N(%rip), %ecx
	movl	$1, %r13d
	xorl	%edi, %edi
	movslq	%r9d, %rbp
	movl	ans(%rip), %r12d
	leaq	k(%rip), %rbx
	leaq	p(%rip), %r11
	sall	%cl, %r13d
	testl	%r13d, %r13d
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%r9d, %r9d
	jle	.L18
	leaq	s(%rip), %rdx
	xorl	%r8d, %r8d
	xorl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rbx,%r8,4), %esi
	xorl	%eax, %eax
	testl	%esi, %esi
	jle	.L14
	movl	(%rdx), %ecx
	movl	%edi, %r15d
	sarl	%cl, %r15d
	movl	%r15d, %eax
	andl	$1, %eax
	cmpl	$1, %esi
	je	.L14
	movl	4(%rdx), %ecx
	movl	%edi, %r14d
	sarl	%cl, %r14d
	xorl	%r15d, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$2, %esi
	je	.L14
	movl	8(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$3, %esi
	je	.L14
	movl	12(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$4, %esi
	je	.L14
	movl	16(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$5, %esi
	je	.L14
	movl	20(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$6, %esi
	je	.L14
	movl	24(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$7, %esi
	je	.L14
	movl	28(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$8, %esi
	je	.L14
	movl	32(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$9, %esi
	je	.L14
	movl	36(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%eax, %r14d
	movl	%r14d, %eax
	andl	$1, %eax
	cmpl	$10, %esi
	je	.L14
	movl	40(%rdx), %ecx
	movl	%edi, %eax
	sarl	%cl, %eax
	xorl	%r14d, %eax
	andl	$1, %eax
.L14:
	cmpl	%eax, (%r11,%r8,4)
	sete	%al
	addq	$1, %r8
	addq	$44, %rdx
	movzbl	%al, %eax
	addl	%eax, %r10d
	cmpq	%r8, %rbp
	jne	.L16
.L12:
	xorl	%eax, %eax
	cmpl	%r10d, %r9d
	sete	%al
	addl	$1, %edi
	addl	%eax, %r12d
	cmpl	%r13d, %edi
	jne	.L9
	movl	%r12d, ans(%rip)
.L10:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$24, %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
.L18:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L12
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	ans
	.bss
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 44
p:
	.zero	44
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 484
s:
	.zero	484
	.globl	k
	.align 32
	.type	k, @object
	.size	k, 44
k:
	.zero	44
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.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:

#include<stdio.h>
int N, M, k[11], s[11][11], p[11];
int ans = 0;
int main(){
	scanf("%d%d", &N, &M);
	for(int i=0; i<M; i++){
		scanf("%d", k+i);
		for(int j=0; j<k[i]; j++){
			scanf("%d", &s[i][j]);
			s[i][j]--;
		}
	}
	for(int i=0; i<M; i++)scanf("%d", p+i);
	for(int S=0; S<(1<<N); S++){
		int cnt = 0;
		for(int i=0; i<M; i++){
			int P = 0;
			for(int j=0; j<k[i]; j++){
				P ^= (S>>s[i][j])&1;
			}
			cnt += P==p[i];
		}
		ans += cnt==M;
	}
	printf("%d\n", ans);
	return 0;
}

2 2
2 1 2
1 2
0 0
 4 2
2 1 2
1 2
0 1
 5 2
1 1 2 5
2 2 3
1 0
 2 3
2 1 2
1 1
1 2
0 0 -1
 4 0
1 1 2
1 2
0 1
 1 0
0 1 4
1 1
0 1
0 0 -1
 9 2
3 1 2 5
2 2 3
1 0
 7 2
2 1 2
1 1
0 1
 8 0
2 1 2
1 1
1 2
0 0 -1
 6 0
-4 0 2
-1 4
1 0
0 0 -2

1
 4
 0
 0
 16
 2
 128
 32
 256
 64

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

```c
#include<stdio.h>
int N, M, k[11], s[11][11], p[11];
int ans = 0;
int main(){
	scanf("%d%d", &N, &M);
	for(int i=0; i<M; i++){
		scanf("%d", k+i);
		for(int j=0; j<k[i]; j++){
			scanf("%d", &s[i][j]);
			s[i][j]--;
		}
	}
	for(int i=0; i<M; i++)scanf("%d", p+i);
	for(int S=0; S<(1<<N); S++){
		int cnt = 0;
		for(int i=0; i<M; i++){
			int P = 0;
			for(int j=0; j<k[i]; j++){
				P ^= (S>>s[i][j])&1;
			}
			cnt += P==p[i];
		}
		ans += cnt==M;
	}
	printf("%d\n", ans);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	k
	.align 32
	.type	k, @object
	.size	k, 44
k:
	.zero	44
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 484
s:
	.zero	484
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 44
p:
	.zero	44
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	leaq	M(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -32(%rbp)
	jmp	.L2
.L5:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L3
.L4:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-28(%rbp), %eax
	movslq	%eax, %rsi
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -28(%rbp)
.L3:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L4
	addl	$1, -32(%rbp)
.L2:
	movl	M(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L5
	movl	$0, -24(%rbp)
	jmp	.L6
.L7:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -24(%rbp)
.L6:
	movl	M(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L7
	movl	$0, -20(%rbp)
	jmp	.L8
.L13:
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L9
.L12:
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	xorl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L10:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	sete	%al
	movzbl	%al, %eax
	addl	%eax, -16(%rbp)
	addl	$1, -12(%rbp)
.L9:
	movl	M(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	movl	M(%rip), %eax
	cmpl	%eax, -16(%rbp)
	sete	%al
	movzbl	%al, %edx
	movl	ans(%rip), %eax
	addl	%edx, %eax
	movl	%eax, ans(%rip)
	addl	$1, -20(%rbp)
.L8:
	movl	N(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cmpl	%eax, -20(%rbp)
	jl	.L13
	movl	ans(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	k
	.align 32
	.type	k, @object
	.size	k, 44
k:
	.zero	44
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 484
s:
	.zero	484
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 44
p:
	.zero	44
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	leaq	M(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -32(%rbp)
	jmp	.L2
.L5:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L3
.L4:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-28(%rbp), %eax
	movslq	%eax, %rsi
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -28(%rbp)
.L3:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L4
	addl	$1, -32(%rbp)
.L2:
	movl	M(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L5
	movl	$0, -24(%rbp)
	jmp	.L6
.L7:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -24(%rbp)
.L6:
	movl	M(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L7
	movl	$0, -20(%rbp)
	jmp	.L8
.L13:
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L9
.L12:
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	xorl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L10:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	sete	%al
	movzbl	%al, %eax
	addl	%eax, -16(%rbp)
	addl	$1, -12(%rbp)
.L9:
	movl	M(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	movl	M(%rip), %eax
	cmpl	%eax, -16(%rbp)
	sete	%al
	movzbl	%al, %edx
	movl	ans(%rip), %eax
	addl	%edx, %eax
	movl	%eax, ans(%rip)
	addl	$1, -20(%rbp)
.L8:
	movl	N(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cmpl	%eax, -20(%rbp)
	jl	.L13
	movl	ans(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
