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

```c
#define L long long int
m[31][50];main(n,p,d,x){L a[50],b;for(;scanf("%d",&n),n;){memset(m,0,6200);for(p=0;p<n;a[p]=(L)1<<p,p++)for(scanf("%d",&x);x;x--)scanf("%d",&d),m[d][p]=1;for(d=1;d<31;d++){for(b=p=0;p<n;p++)if(m[d][p])b|=a[p];for(p=0;p<n;p++)if(m[d][p]&&(a[p]=b)==((L)1<<n)-1){printf("%d\n",d);goto s;}}puts("-1");s:;}return 0;}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 6200
m:
	.zero	6200
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"-1"
	.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	$448, %rsp
	movl	%edi, -436(%rbp)
	movl	%esi, -440(%rbp)
	movl	%edx, -444(%rbp)
	movl	%ecx, -448(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L16:
	movl	$6200, %edx
	movl	$0, %esi
	leaq	m(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -440(%rbp)
	jmp	.L3
.L6:
	leaq	-448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L4
.L5:
	leaq	-444(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-444(%rbp), %eax
	movl	-440(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-448(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -448(%rbp)
.L4:
	movl	-448(%rbp), %eax
	testl	%eax, %eax
	jne	.L5
	movl	-440(%rbp), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	salq	%cl, %rdx
	movl	-440(%rbp), %eax
	cltq
	movq	%rdx, -416(%rbp,%rax,8)
	addl	$1, -440(%rbp)
.L3:
	movl	-436(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L6
	movl	$1, -444(%rbp)
	jmp	.L7
.L15:
	movl	$0, -440(%rbp)
	movq	$0, -424(%rbp)
	jmp	.L8
.L10:
	movl	-444(%rbp), %eax
	movl	-440(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L9
	movl	-440(%rbp), %eax
	cltq
	movq	-416(%rbp,%rax,8), %rax
	orq	%rax, -424(%rbp)
.L9:
	addl	$1, -440(%rbp)
.L8:
	movl	-436(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L10
	movl	$0, -440(%rbp)
	jmp	.L11
.L14:
	movl	-444(%rbp), %eax
	movl	-440(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L12
	movl	-440(%rbp), %eax
	cltq
	movq	-424(%rbp), %rdx
	movq	%rdx, -416(%rbp,%rax,8)
	movl	-440(%rbp), %eax
	cltq
	movq	-416(%rbp,%rax,8), %rdx
	movl	-436(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %ecx
	salq	%cl, %rsi
	movq	%rsi, %rax
	subq	$1, %rax
	cmpq	%rax, %rdx
	jne	.L12
	movl	-444(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L2
.L12:
	addl	$1, -440(%rbp)
.L11:
	movl	-436(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L14
	movl	-444(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -444(%rbp)
.L7:
	movl	-444(%rbp), %eax
	cmpl	$30, %eax
	jle	.L15
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L13:
.L2:
	leaq	-436(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-436(%rbp), %eax
	testl	%eax, %eax
	jne	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	m(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	subq	$472, %rsp
	.cfi_def_cfa_offset 528
	movl	%edi, 44(%rsp)
	movl	%edx, 40(%rsp)
	movl	%ecx, 36(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 456(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	24(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	44(%rsp), %r8d
	testl	%r8d, %r8d
	je	.L31
	movl	$775, %ecx
	movl	$0, %eax
	movq	%r12, %rdi
	rep stosq
	jle	.L3
	leaq	36(%rsp), %rax
	xorl	%r14d, %r14d
	leaq	40(%rsp), %r13
	movq	%rax, 8(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L5:
	movq	8(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movslq	%r14d, %rbp
	movq	%rbp, %r15
	call	scanf@PLT
	movl	36(%rsp), %eax
	testl	%eax, %eax
	je	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%rbx, %rdi
	call	scanf@PLT
	movslq	40(%rsp), %rax
	subl	$1, 36(%rsp)
	leaq	(%rax,%rax,4), %rax
	leaq	(%rax,%rax,4), %rax
	leaq	0(%rbp,%rax,2), %rax
	movl	$1, (%r12,%rax,4)
	jne	.L4
.L6:
	movq	16(%rsp), %rdx
	movl	$1, %eax
	movl	%r15d, %ecx
	movl	44(%rsp), %r8d
	salq	%cl, %rax
	movq	%rax, (%rdx,%r14,8)
	addq	$1, %r14
	cmpl	%r14d, %r8d
	jg	.L5
.L3:
	movl	$1, %r9d
	movl	%r8d, %ecx
	xorl	%r11d, %r11d
	movslq	%r8d, %rsi
	movl	$1, 40(%rsp)
	salq	%cl, %r9
	leaq	48(%rsp), %rdi
	leaq	200+m(%rip), %rdx
	subq	$1, %r9
	movl	$1, %r10d
.L7:
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	testl	%r8d, %r8d
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rdx,%rax,4), %r13d
	testl	%r13d, %r13d
	je	.L8
	orq	(%rdi,%rax,8), %rcx
.L8:
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L9
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rdx,%rax,4), %ebp
	testl	%ebp, %ebp
	je	.L10
	movq	%rcx, (%rdi,%rax,8)
	cmpq	%rcx, %r9
	je	.L32
.L10:
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L13
.L16:
	addl	$1, %r10d
	addq	$200, %rdx
	movl	$1, %r11d
	cmpl	$31, %r10d
	je	.L14
	movl	%r10d, 32(%rsp)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L32:
	testb	%r11b, %r11b
	je	.L11
	movl	32(%rsp), %eax
	movl	%eax, 40(%rsp)
.L11:
	movl	%r10d, %esi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
.L14:
	leaq	.LC2(%rip), %rdi
	movl	$31, 40(%rsp)
	call	puts@PLT
	jmp	.L2
.L31:
	movq	456(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L33
	addq	$472, %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
.L33:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 6200
m:
	.zero	6200
	.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"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	m(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	subq	$472, %rsp
	.cfi_def_cfa_offset 528
	movl	%edi, 44(%rsp)
	movl	%edx, 40(%rsp)
	movl	%ecx, 36(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 456(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	24(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	44(%rsp), %r8d
	testl	%r8d, %r8d
	je	.L31
	movl	$775, %ecx
	movl	$0, %eax
	movq	%r12, %rdi
	rep stosq
	jle	.L3
	leaq	36(%rsp), %rax
	xorl	%r14d, %r14d
	leaq	40(%rsp), %r13
	movq	%rax, 8(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L5:
	movq	8(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movslq	%r14d, %rbp
	movq	%rbp, %r15
	call	scanf@PLT
	movl	36(%rsp), %eax
	testl	%eax, %eax
	je	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%rbx, %rdi
	call	scanf@PLT
	movslq	40(%rsp), %rax
	subl	$1, 36(%rsp)
	leaq	(%rax,%rax,4), %rax
	leaq	(%rax,%rax,4), %rax
	leaq	0(%rbp,%rax,2), %rax
	movl	$1, (%r12,%rax,4)
	jne	.L4
.L6:
	movq	16(%rsp), %rdx
	movl	$1, %eax
	movl	%r15d, %ecx
	movl	44(%rsp), %r8d
	salq	%cl, %rax
	movq	%rax, (%rdx,%r14,8)
	addq	$1, %r14
	cmpl	%r14d, %r8d
	jg	.L5
.L3:
	movl	$1, %r9d
	movl	%r8d, %ecx
	xorl	%r11d, %r11d
	movslq	%r8d, %rsi
	movl	$1, 40(%rsp)
	salq	%cl, %r9
	leaq	48(%rsp), %rdi
	leaq	200+m(%rip), %rdx
	subq	$1, %r9
	movl	$1, %r10d
.L7:
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	testl	%r8d, %r8d
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rdx,%rax,4), %r13d
	testl	%r13d, %r13d
	je	.L8
	orq	(%rdi,%rax,8), %rcx
.L8:
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L9
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rdx,%rax,4), %ebp
	testl	%ebp, %ebp
	je	.L10
	movq	%rcx, (%rdi,%rax,8)
	cmpq	%rcx, %r9
	je	.L32
.L10:
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L13
.L16:
	addl	$1, %r10d
	addq	$200, %rdx
	movl	$1, %r11d
	cmpl	$31, %r10d
	je	.L14
	movl	%r10d, 32(%rsp)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L32:
	testb	%r11b, %r11b
	je	.L11
	movl	32(%rsp), %eax
	movl	%eax, 40(%rsp)
.L11:
	movl	%r10d, %esi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
.L14:
	leaq	.LC2(%rip), %rdi
	movl	$31, 40(%rsp)
	call	puts@PLT
	jmp	.L2
.L31:
	movq	456(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L33
	addq	$472, %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
.L33:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 6200
m:
	.zero	6200
	.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:

#define L long long int
m[31][50];main(n,p,d,x){L a[50],b;for(;scanf("%d",&n),n;){memset(m,0,6200);for(p=0;p<n;a[p]=(L)1<<p,p++)for(scanf("%d",&x);x;x--)scanf("%d",&d),m[d][p]=1;for(d=1;d<31;d++){for(b=p=0;p<n;p++)if(m[d][p])b|=a[p];for(p=0;p<n;p++)if(m[d][p]&&(a[p]=b)==((L)1<<n)-1){printf("%d\n",d);goto s;}}puts("-1");s:;}return 0;}
4
1 1
2 2 3
2 1 2
3 4 4 5
0
 4
1 1
2 2 3
2 1 2
3 3 4 10
0
 4
1 1
2 2 5
2 0 2
3 1 4 5
0
 4
1 1
2 2 3
2 1 2
3 1 4 5
0
 4
1 1
2 1 3
2 0 1
3 1 4 5
0
 4
1 1
2 2 3
2 0 4
3 1 4 2
0
 4
1 1
2 2 3
2 1 2
3 4 4 0
0
 4
1 1
2 2 3
2 2 2
3 3 4 5
0
 4
1 1
1 2 3
2 1 2
3 4 4 0
0
 4
1 1
1 3 3
2 1 2
3 4 4 0
0

-1
 3
 5
 2
 1
 4
 -1
 -1
 -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
#define L long long int
m[31][50];main(n,p,d,x){L a[50],b;for(;scanf("%d",&n),n;){memset(m,0,6200);for(p=0;p<n;a[p]=(L)1<<p,p++)for(scanf("%d",&x);x;x--)scanf("%d",&d),m[d][p]=1;for(d=1;d<31;d++){for(b=p=0;p<n;p++)if(m[d][p])b|=a[p];for(p=0;p<n;p++)if(m[d][p]&&(a[p]=b)==((L)1<<n)-1){printf("%d\n",d);goto s;}}puts("-1");s:;}return 0;}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 6200
m:
	.zero	6200
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"-1"
	.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	$448, %rsp
	movl	%edi, -436(%rbp)
	movl	%esi, -440(%rbp)
	movl	%edx, -444(%rbp)
	movl	%ecx, -448(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L16:
	movl	$6200, %edx
	movl	$0, %esi
	leaq	m(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -440(%rbp)
	jmp	.L3
.L6:
	leaq	-448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L4
.L5:
	leaq	-444(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-444(%rbp), %eax
	movl	-440(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-448(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -448(%rbp)
.L4:
	movl	-448(%rbp), %eax
	testl	%eax, %eax
	jne	.L5
	movl	-440(%rbp), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	salq	%cl, %rdx
	movl	-440(%rbp), %eax
	cltq
	movq	%rdx, -416(%rbp,%rax,8)
	addl	$1, -440(%rbp)
.L3:
	movl	-436(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L6
	movl	$1, -444(%rbp)
	jmp	.L7
.L15:
	movl	$0, -440(%rbp)
	movq	$0, -424(%rbp)
	jmp	.L8
.L10:
	movl	-444(%rbp), %eax
	movl	-440(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L9
	movl	-440(%rbp), %eax
	cltq
	movq	-416(%rbp,%rax,8), %rax
	orq	%rax, -424(%rbp)
.L9:
	addl	$1, -440(%rbp)
.L8:
	movl	-436(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L10
	movl	$0, -440(%rbp)
	jmp	.L11
.L14:
	movl	-444(%rbp), %eax
	movl	-440(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L12
	movl	-440(%rbp), %eax
	cltq
	movq	-424(%rbp), %rdx
	movq	%rdx, -416(%rbp,%rax,8)
	movl	-440(%rbp), %eax
	cltq
	movq	-416(%rbp,%rax,8), %rdx
	movl	-436(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %ecx
	salq	%cl, %rsi
	movq	%rsi, %rax
	subq	$1, %rax
	cmpq	%rax, %rdx
	jne	.L12
	movl	-444(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L2
.L12:
	addl	$1, -440(%rbp)
.L11:
	movl	-436(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L14
	movl	-444(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -444(%rbp)
.L7:
	movl	-444(%rbp), %eax
	cmpl	$30, %eax
	jle	.L15
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L13:
.L2:
	leaq	-436(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-436(%rbp), %eax
	testl	%eax, %eax
	jne	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 6200
m:
	.zero	6200
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"-1"
	.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	$448, %rsp
	movl	%edi, -436(%rbp)
	movl	%esi, -440(%rbp)
	movl	%edx, -444(%rbp)
	movl	%ecx, -448(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L16:
	movl	$6200, %edx
	movl	$0, %esi
	leaq	m(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -440(%rbp)
	jmp	.L3
.L6:
	leaq	-448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L4
.L5:
	leaq	-444(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-444(%rbp), %eax
	movl	-440(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-448(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -448(%rbp)
.L4:
	movl	-448(%rbp), %eax
	testl	%eax, %eax
	jne	.L5
	movl	-440(%rbp), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	salq	%cl, %rdx
	movl	-440(%rbp), %eax
	cltq
	movq	%rdx, -416(%rbp,%rax,8)
	addl	$1, -440(%rbp)
.L3:
	movl	-436(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L6
	movl	$1, -444(%rbp)
	jmp	.L7
.L15:
	movl	$0, -440(%rbp)
	movq	$0, -424(%rbp)
	jmp	.L8
.L10:
	movl	-444(%rbp), %eax
	movl	-440(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L9
	movl	-440(%rbp), %eax
	cltq
	movq	-416(%rbp,%rax,8), %rax
	orq	%rax, -424(%rbp)
.L9:
	addl	$1, -440(%rbp)
.L8:
	movl	-436(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L10
	movl	$0, -440(%rbp)
	jmp	.L11
.L14:
	movl	-444(%rbp), %eax
	movl	-440(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L12
	movl	-440(%rbp), %eax
	cltq
	movq	-424(%rbp), %rdx
	movq	%rdx, -416(%rbp,%rax,8)
	movl	-440(%rbp), %eax
	cltq
	movq	-416(%rbp,%rax,8), %rdx
	movl	-436(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %ecx
	salq	%cl, %rsi
	movq	%rsi, %rax
	subq	$1, %rax
	cmpq	%rax, %rdx
	jne	.L12
	movl	-444(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L2
.L12:
	addl	$1, -440(%rbp)
.L11:
	movl	-436(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L14
	movl	-444(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -444(%rbp)
.L7:
	movl	-444(%rbp), %eax
	cmpl	$30, %eax
	jle	.L15
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L13:
.L2:
	leaq	-436(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-436(%rbp), %eax
	testl	%eax, %eax
	jne	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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:
