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

```c
a[1111],b[1111],c[1111],d[1111],p[333],i,j,x,y,z;main(){for(;scanf("%d%d%d",a,b,c)&&(*a+=*b+*c);){for(i=332;i;p[i--]=2);for(i=0,scanf("%d",p);i++<*p;scanf("%d%d%d%d",a+i,b+i,c+i,d+i));for(i=0;i++<*p;)for(j=0;j++<*p;d[j]?p[a[j]]=p[b[j]]=p[c[j]]=1:(x=p[a[j]]&1)&(y=p[b[j]]&1)?p[c[j]]=0:x&(z=p[c[j]])?p[b[j]]=0:y&z?p[a[j]]=0:0);for(i=0;i<*a;printf("%d\n",p[++i]));}return 0;}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 4444
a:
	.zero	4444
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 4444
b:
	.zero	4444
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 4444
c:
	.zero	4444
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 4444
d:
	.zero	4444
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 1332
p:
	.zero	1332
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	y
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.zero	4
	.globl	z
	.align 4
	.type	z, @object
	.size	z, 4
z:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d%d"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d%d%d"
	.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
	jmp	.L2
.L21:
	movl	$332, i(%rip)
	jmp	.L3
.L4:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	$2, (%rdx,%rax)
.L3:
	movl	i(%rip), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$0, i(%rip)
	leaq	p(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L5
.L6:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	leaq	(%rdx,%rax), %rsi
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdi
	leaq	a(%rip), %rax
	addq	%rdi, %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
.L5:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	p(%rip), %edx
	cmpl	%edx, %eax
	jl	.L6
	movl	$0, i(%rip)
	jmp	.L7
.L17:
	movl	$0, j(%rip)
	jmp	.L8
.L16:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L9
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rax
	movl	$1, (%rcx,%rax)
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movslq	%eax, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	p(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L8
.L9:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	$1, %eax
	movl	%eax, x(%rip)
	movl	x(%rip), %ecx
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	$1, %eax
	movl	%eax, y(%rip)
	movl	y(%rip), %eax
	andl	%ecx, %eax
	testl	%eax, %eax
	je	.L10
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L8
.L10:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, z(%rip)
	movl	z(%rip), %edx
	movl	x(%rip), %eax
	andl	%edx, %eax
	testl	%eax, %eax
	je	.L12
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L8
.L12:
	movl	y(%rip), %edx
	movl	z(%rip), %eax
	andl	%edx, %eax
	testl	%eax, %eax
	je	.L8
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	$0, (%rdx,%rax)
.L8:
	movl	j(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, j(%rip)
	movl	p(%rip), %edx
	cmpl	%edx, %eax
	jl	.L16
.L7:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	p(%rip), %edx
	cmpl	%edx, %eax
	jl	.L17
	movl	$0, i(%rip)
	jmp	.L18
.L19:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L18:
	movl	a(%rip), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jg	.L19
.L2:
	leaq	c(%rip), %rax
	movq	%rax, %rcx
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	testl	%eax, %eax
	je	.L20
	movl	a(%rip), %eax
	movl	b(%rip), %ecx
	movl	c(%rip), %edx
	addl	%ecx, %edx
	addl	%edx, %eax
	movl	%eax, a(%rip)
	movl	a(%rip), %eax
	testl	%eax, %eax
	jne	.L21
.L20:
	movl	$0, %eax
	popq	%rbp
	.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
.LC1:
	.string	"%d"
.LC2:
	.string	"%d%d%d%d"
.LC6:
	.string	"%d\n"
.LC7:
	.string	"%d%d%d"
	.section	.text.unlikely,"ax",@progbits
.LCOLDB8:
	.section	.text.startup,"ax",@progbits
.LHOTB8:
	.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
	movl	%r9d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%eax, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	leaq	c(%rip), %rcx
	leaq	b(%rip), %rdx
	leaq	a(%rip), %rsi
	leaq	.LC7(%rip), %rdi
	call	scanf@PLT
	testl	%eax, %eax
	je	.L51
	leaq	b(%rip), %rdi
	leaq	c(%rip), %rax
	movl	(%rax), %eax
	addl	(%rdi), %eax
	leaq	a(%rip), %rdi
	addl	%eax, (%rdi)
	je	.L51
	leaq	1316+p(%rip), %rax
	leaq	-1328(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L3:
	movdqa	.LC0(%rip), %xmm0
	subq	$16, %rax
	movups	%xmm0, 16(%rax)
	cmpq	%rax, %rdx
	jne	.L3
	leaq	p(%rip), %rbx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	movl	$0, i(%rip)
	movq	%rbx, %rsi
	call	scanf@PLT
	movl	i(%rip), %edx
	movl	p(%rip), %edi
	leal	1(%rdx), %eax
	movl	%eax, i(%rip)
	cmpl	%edi, %edx
	jge	.L4
	leaq	d(%rip), %r14
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	cltq
	leaq	c(%rip), %rdi
	salq	$2, %rax
	leaq	(%rdi,%rax), %rcx
	leaq	b(%rip), %rdi
	leaq	(%rdi,%rax), %rdx
	leaq	a(%rip), %rdi
	leaq	(%rdi,%rax), %rsi
	leaq	(%r14,%rax), %r8
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	i(%rip), %edx
	movl	(%rbx), %edi
	leal	1(%rdx), %eax
	movl	%eax, i(%rip)
	cmpl	%edi, %edx
	jl	.L5
.L4:
	testl	%edi, %edi
	jle	.L7
	movb	$0, 11(%rsp)
	xorl	%r8d, %r8d
	leaq	4+a(%rip), %r13
	leaq	4+b(%rip), %r11
	movl	$2, 4(%rsp)
	leaq	4+c(%rip), %r10
	leaq	4+d(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L6:
	movl	4(%rsp), %eax
	movl	%eax, 12(%rsp)
	xorl	%eax, %eax
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L56:
	movl	$1, (%rbx,%rsi,4)
	movl	$1, (%rbx,%rdx,4)
	movl	$1, (%rbx,%rcx,4)
	movl	(%rbx), %edi
.L9:
	leal	2(%rax), %edx
	addq	$1, %rax
	cmpl	%eax, %edi
	jle	.L55
.L12:
	movl	(%r9,%rax,4), %r14d
	movslq	0(%r13,%rax,4), %rcx
	movslq	(%r11,%rax,4), %rdx
	movslq	(%r10,%rax,4), %rsi
	testl	%r14d, %r14d
	jne	.L56
	movl	(%rbx,%rcx,4), %r12d
	movl	(%rbx,%rdx,4), %r14d
	movl	%r12d, %r8d
	andl	$1, %r14d
	andl	$1, %r8d
	andl	%r14d, %r12d
	je	.L10
	movl	$0, (%rbx,%rsi,4)
	movl	(%rbx), %edi
	leal	2(%rax), %edx
	addq	$1, %rax
	movl	%r12d, %ebp
	movl	$1, %r8d
	cmpl	%eax, %edi
	jg	.L12
.L55:
	movl	4(%rsp), %eax
	leal	-1(%rax), %ecx
	cmpl	%edi, %ecx
	jge	.L26
	addl	$1, %eax
	movl	%eax, 4(%rsp)
	testl	%edi, %edi
	jg	.L6
	cmpl	%edi, 12(%rsp)
	jl	.L25
	movl	$1, %edx
.L26:
	cmpb	$0, 11(%rsp)
	movl	%edx, j(%rip)
	je	.L16
	movl	%r15d, z(%rip)
.L16:
	testb	%r8b, %r8b
	je	.L7
	movl	%r12d, y(%rip)
	movl	%ebp, x(%rip)
.L7:
	leaq	a(%rip), %rdi
	xorl	%eax, %eax
	leaq	.LC6(%rip), %r13
	movl	$0, i(%rip)
	movl	(%rdi), %edx
	testl	%edx, %edx
	jle	.L2
	.p2align 4,,10
	.p2align 3
.L18:
	addl	$1, %eax
	movq	%r13, %rdi
	movl	%eax, i(%rip)
	cltq
	movl	(%rbx,%rax,4), %esi
	xorl	%eax, %eax
	call	printf@PLT
	leaq	a(%rip), %rdi
	movl	i(%rip), %eax
	cmpl	%eax, (%rdi)
	jg	.L18
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rbx,%rsi,4), %r15d
	movl	%r8d, %ebp
	andl	%r15d, %ebp
	je	.L11
	movl	$0, (%rbx,%rdx,4)
	movl	$1, %r8d
	movl	(%rbx), %edi
	movb	$1, 11(%rsp)
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%r14d, %r12d
	andl	%r15d, %r12d
	je	.L30
	movl	$0, (%rbx,%rcx,4)
	movl	$1, %r8d
	movl	(%rbx), %edi
	movb	$1, 11(%rsp)
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L30:
	movl	%r8d, %ebp
	movb	$1, 11(%rsp)
	movl	%r14d, %r12d
	movl	$1, %r8d
	jmp	.L9
.L51:
	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
.L25:
	.cfi_restore_state
	movl	4(%rsp), %esi
	movl	%edi, %edx
	movl	$1, %ecx
	subl	%esi, %edx
	cmpl	%edi, %esi
	leal	1(%rdx), %eax
	cmovg	%ecx, %eax
	cmpl	$2, %edx
	jbe	.L34
	cmpl	%edi, %esi
	jle	.L49
.L34:
	movl	4(%rsp), %edx
.L23:
	cmpl	%edi, %edx
	jge	.L15
	jmp	.L15
	.cfi_endproc
	.section	.text.unlikely
	.cfi_startproc
	.type	main.cold, @function
main.cold:
.LFSB0:
.L49:
	.cfi_def_cfa_offset 80
	.cfi_offset 3, -56
	.cfi_offset 6, -48
	.cfi_offset 12, -40
	.cfi_offset 13, -32
	.cfi_offset 14, -24
	.cfi_offset 15, -16
	movl	%eax, %ecx
	xorl	%edx, %edx
	shrl	$2, %ecx
.L14:
	addl	$1, %edx
	cmpl	%edx, %ecx
	jne	.L14
	movl	4(%rsp), %edx
	movl	%eax, %ecx
	andl	$-4, %ecx
	addl	%ecx, %edx
	cmpl	%eax, %ecx
	jne	.L23
.L15:
	movl	$1, %edx
	jmp	.L26
	.cfi_endproc
.LFE0:
	.section	.text.startup
	.size	main, .-main
	.section	.text.unlikely
	.size	main.cold, .-main.cold
.LCOLDE8:
	.section	.text.startup
.LHOTE8:
	.globl	z
	.bss
	.align 4
	.type	z, @object
	.size	z, 4
z:
	.zero	4
	.globl	y
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 1332
p:
	.zero	1332
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 4444
d:
	.zero	4444
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 4444
c:
	.zero	4444
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 4444
b:
	.zero	4444
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 4444
a:
	.zero	4444
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	2
	.long	2
	.long	2
	.long	2
	.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
.LC1:
	.string	"%d"
.LC2:
	.string	"%d%d%d%d"
.LC6:
	.string	"%d\n"
.LC7:
	.string	"%d%d%d"
	.section	.text.unlikely,"ax",@progbits
.LCOLDB8:
	.section	.text.startup,"ax",@progbits
.LHOTB8:
	.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
	movl	%r9d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%eax, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	leaq	c(%rip), %rcx
	leaq	b(%rip), %rdx
	leaq	a(%rip), %rsi
	leaq	.LC7(%rip), %rdi
	call	scanf@PLT
	testl	%eax, %eax
	je	.L51
	leaq	b(%rip), %rdi
	leaq	c(%rip), %rax
	movl	(%rax), %eax
	addl	(%rdi), %eax
	leaq	a(%rip), %rdi
	addl	%eax, (%rdi)
	je	.L51
	leaq	1316+p(%rip), %rax
	leaq	-1328(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L3:
	movdqa	.LC0(%rip), %xmm0
	subq	$16, %rax
	movups	%xmm0, 16(%rax)
	cmpq	%rax, %rdx
	jne	.L3
	leaq	p(%rip), %rbx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	movl	$0, i(%rip)
	movq	%rbx, %rsi
	call	scanf@PLT
	movl	i(%rip), %edx
	movl	p(%rip), %edi
	leal	1(%rdx), %eax
	movl	%eax, i(%rip)
	cmpl	%edi, %edx
	jge	.L4
	leaq	d(%rip), %r14
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	cltq
	leaq	c(%rip), %rdi
	salq	$2, %rax
	leaq	(%rdi,%rax), %rcx
	leaq	b(%rip), %rdi
	leaq	(%rdi,%rax), %rdx
	leaq	a(%rip), %rdi
	leaq	(%rdi,%rax), %rsi
	leaq	(%r14,%rax), %r8
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	i(%rip), %edx
	movl	(%rbx), %edi
	leal	1(%rdx), %eax
	movl	%eax, i(%rip)
	cmpl	%edi, %edx
	jl	.L5
.L4:
	testl	%edi, %edi
	jle	.L7
	movb	$0, 11(%rsp)
	xorl	%r8d, %r8d
	leaq	4+a(%rip), %r13
	leaq	4+b(%rip), %r11
	movl	$2, 4(%rsp)
	leaq	4+c(%rip), %r10
	leaq	4+d(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L6:
	movl	4(%rsp), %eax
	movl	%eax, 12(%rsp)
	xorl	%eax, %eax
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L56:
	movl	$1, (%rbx,%rsi,4)
	movl	$1, (%rbx,%rdx,4)
	movl	$1, (%rbx,%rcx,4)
	movl	(%rbx), %edi
.L9:
	leal	2(%rax), %edx
	addq	$1, %rax
	cmpl	%eax, %edi
	jle	.L55
.L12:
	movl	(%r9,%rax,4), %r14d
	movslq	0(%r13,%rax,4), %rcx
	movslq	(%r11,%rax,4), %rdx
	movslq	(%r10,%rax,4), %rsi
	testl	%r14d, %r14d
	jne	.L56
	movl	(%rbx,%rcx,4), %r12d
	movl	(%rbx,%rdx,4), %r14d
	movl	%r12d, %r8d
	andl	$1, %r14d
	andl	$1, %r8d
	andl	%r14d, %r12d
	je	.L10
	movl	$0, (%rbx,%rsi,4)
	movl	(%rbx), %edi
	leal	2(%rax), %edx
	addq	$1, %rax
	movl	%r12d, %ebp
	movl	$1, %r8d
	cmpl	%eax, %edi
	jg	.L12
.L55:
	movl	4(%rsp), %eax
	leal	-1(%rax), %ecx
	cmpl	%edi, %ecx
	jge	.L26
	addl	$1, %eax
	movl	%eax, 4(%rsp)
	testl	%edi, %edi
	jg	.L6
	cmpl	%edi, 12(%rsp)
	jl	.L25
	movl	$1, %edx
.L26:
	cmpb	$0, 11(%rsp)
	movl	%edx, j(%rip)
	je	.L16
	movl	%r15d, z(%rip)
.L16:
	testb	%r8b, %r8b
	je	.L7
	movl	%r12d, y(%rip)
	movl	%ebp, x(%rip)
.L7:
	leaq	a(%rip), %rdi
	xorl	%eax, %eax
	leaq	.LC6(%rip), %r13
	movl	$0, i(%rip)
	movl	(%rdi), %edx
	testl	%edx, %edx
	jle	.L2
	.p2align 4,,10
	.p2align 3
.L18:
	addl	$1, %eax
	movq	%r13, %rdi
	movl	%eax, i(%rip)
	cltq
	movl	(%rbx,%rax,4), %esi
	xorl	%eax, %eax
	call	printf@PLT
	leaq	a(%rip), %rdi
	movl	i(%rip), %eax
	cmpl	%eax, (%rdi)
	jg	.L18
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rbx,%rsi,4), %r15d
	movl	%r8d, %ebp
	andl	%r15d, %ebp
	je	.L11
	movl	$0, (%rbx,%rdx,4)
	movl	$1, %r8d
	movl	(%rbx), %edi
	movb	$1, 11(%rsp)
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%r14d, %r12d
	andl	%r15d, %r12d
	je	.L30
	movl	$0, (%rbx,%rcx,4)
	movl	$1, %r8d
	movl	(%rbx), %edi
	movb	$1, 11(%rsp)
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L30:
	movl	%r8d, %ebp
	movb	$1, 11(%rsp)
	movl	%r14d, %r12d
	movl	$1, %r8d
	jmp	.L9
.L51:
	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
.L25:
	.cfi_restore_state
	movl	4(%rsp), %esi
	movl	%edi, %edx
	movl	$1, %ecx
	subl	%esi, %edx
	cmpl	%edi, %esi
	leal	1(%rdx), %eax
	cmovg	%ecx, %eax
	cmpl	$2, %edx
	jbe	.L34
	cmpl	%edi, %esi
	jle	.L49
.L34:
	movl	4(%rsp), %edx
.L23:
	cmpl	%edi, %edx
	jge	.L15
	jmp	.L15
	.cfi_endproc
	.section	.text.unlikely
	.cfi_startproc
	.type	main.cold, @function
main.cold:
.LFSB0:
.L49:
	.cfi_def_cfa_offset 80
	.cfi_offset 3, -56
	.cfi_offset 6, -48
	.cfi_offset 12, -40
	.cfi_offset 13, -32
	.cfi_offset 14, -24
	.cfi_offset 15, -16
	movl	%eax, %ecx
	xorl	%edx, %edx
	shrl	$2, %ecx
.L14:
	addl	$1, %edx
	cmpl	%edx, %ecx
	jne	.L14
	movl	4(%rsp), %edx
	movl	%eax, %ecx
	andl	$-4, %ecx
	addl	%ecx, %edx
	cmpl	%eax, %ecx
	jne	.L23
.L15:
	movl	$1, %edx
	jmp	.L26
	.cfi_endproc
.LFE0:
	.section	.text.startup
	.size	main, .-main
	.section	.text.unlikely
	.size	main.cold, .-main.cold
.LCOLDE8:
	.section	.text.startup
.LHOTE8:
	.globl	z
	.bss
	.align 4
	.type	z, @object
	.size	z, 4
z:
	.zero	4
	.globl	y
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 1332
p:
	.zero	1332
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 4444
d:
	.zero	4444
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 4444
c:
	.zero	4444
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 4444
b:
	.zero	4444
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 4444
a:
	.zero	4444
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	2
	.long	2
	.long	2
	.long	2
	.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:

a[1111],b[1111],c[1111],d[1111],p[333],i,j,x,y,z;main(){for(;scanf("%d%d%d",a,b,c)&&(*a+=*b+*c);){for(i=332;i;p[i--]=2);for(i=0,scanf("%d",p);i++<*p;scanf("%d%d%d%d",a+i,b+i,c+i,d+i));for(i=0;i++<*p;)for(j=0;j++<*p;d[j]?p[a[j]]=p[b[j]]=p[c[j]]=1:(x=p[a[j]]&1)&(y=p[b[j]]&1)?p[c[j]]=0:x&(z=p[c[j]])?p[b[j]]=0:y&z?p[a[j]]=0:0);for(i=0;i<*a;printf("%d\n",p[++i]));}return 0;}
2 2 2
4
2 4 5 0
2 3 6 0
1 4 5 0
2 3 2 1
0 0 0
 2 2 2
4
2 4 5 0
2 3 6 0
1 4 5 0
2 3 2 0
0 0 0
 3 2 2
4
2 4 5 0
2 3 6 0
1 4 5 0
2 3 5 1
0 0 0
 2 2 2
4
3 4 5 0
2 3 6 0
1 4 4 1
2 3 2 0
0 0 0
 2 2 2
4
2 4 5 0
1 3 6 0
1 4 5 0
2 3 2 1
0 0 0
 3 2 2
4
2 4 5 0
2 4 6 0
1 4 5 0
2 3 5 1
0 0 0
 2 2 3
4
2 4 5 0
2 1 6 0
1 4 5 0
4 3 5 1
0 0 0
 2 2 4
4
3 1 1 0
4 3 4 0
1 4 0 0
1 3 2 0
0 0 0
 1 2 4
4
3 1 1 0
5 3 4 0
1 4 1 0
1 3 0 0
0 0 0
 2 2 2
4
2 4 5 0
2 3 6 0
1 4 5 0
1 3 5 1
0 0 0

2
1
1
2
2
0
 2
2
2
2
2
2
 2
1
1
0
1
0
2
 1
2
2
1
2
2
 2
1
1
2
2
2
 2
1
1
0
1
2
2
 0
0
1
1
1
2
2
 2
2
2
2
2
2
2
2
 2
2
2
2
2
2
2
 1
2
1
0
1
2

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

```c
a[1111],b[1111],c[1111],d[1111],p[333],i,j,x,y,z;main(){for(;scanf("%d%d%d",a,b,c)&&(*a+=*b+*c);){for(i=332;i;p[i--]=2);for(i=0,scanf("%d",p);i++<*p;scanf("%d%d%d%d",a+i,b+i,c+i,d+i));for(i=0;i++<*p;)for(j=0;j++<*p;d[j]?p[a[j]]=p[b[j]]=p[c[j]]=1:(x=p[a[j]]&1)&(y=p[b[j]]&1)?p[c[j]]=0:x&(z=p[c[j]])?p[b[j]]=0:y&z?p[a[j]]=0:0);for(i=0;i<*a;printf("%d\n",p[++i]));}return 0;}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 4444
a:
	.zero	4444
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 4444
b:
	.zero	4444
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 4444
c:
	.zero	4444
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 4444
d:
	.zero	4444
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 1332
p:
	.zero	1332
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	y
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.zero	4
	.globl	z
	.align 4
	.type	z, @object
	.size	z, 4
z:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d%d"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d%d%d"
	.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
	jmp	.L2
.L21:
	movl	$332, i(%rip)
	jmp	.L3
.L4:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	$2, (%rdx,%rax)
.L3:
	movl	i(%rip), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$0, i(%rip)
	leaq	p(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L5
.L6:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	leaq	(%rdx,%rax), %rsi
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdi
	leaq	a(%rip), %rax
	addq	%rdi, %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
.L5:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	p(%rip), %edx
	cmpl	%edx, %eax
	jl	.L6
	movl	$0, i(%rip)
	jmp	.L7
.L17:
	movl	$0, j(%rip)
	jmp	.L8
.L16:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L9
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rax
	movl	$1, (%rcx,%rax)
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movslq	%eax, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	p(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L8
.L9:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	$1, %eax
	movl	%eax, x(%rip)
	movl	x(%rip), %ecx
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	$1, %eax
	movl	%eax, y(%rip)
	movl	y(%rip), %eax
	andl	%ecx, %eax
	testl	%eax, %eax
	je	.L10
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L8
.L10:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, z(%rip)
	movl	z(%rip), %edx
	movl	x(%rip), %eax
	andl	%edx, %eax
	testl	%eax, %eax
	je	.L12
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L8
.L12:
	movl	y(%rip), %edx
	movl	z(%rip), %eax
	andl	%edx, %eax
	testl	%eax, %eax
	je	.L8
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	$0, (%rdx,%rax)
.L8:
	movl	j(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, j(%rip)
	movl	p(%rip), %edx
	cmpl	%edx, %eax
	jl	.L16
.L7:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	p(%rip), %edx
	cmpl	%edx, %eax
	jl	.L17
	movl	$0, i(%rip)
	jmp	.L18
.L19:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L18:
	movl	a(%rip), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jg	.L19
.L2:
	leaq	c(%rip), %rax
	movq	%rax, %rcx
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	testl	%eax, %eax
	je	.L20
	movl	a(%rip), %eax
	movl	b(%rip), %ecx
	movl	c(%rip), %edx
	addl	%ecx, %edx
	addl	%edx, %eax
	movl	%eax, a(%rip)
	movl	a(%rip), %eax
	testl	%eax, %eax
	jne	.L21
.L20:
	movl	$0, %eax
	popq	%rbp
	.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	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 4444
a:
	.zero	4444
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 4444
b:
	.zero	4444
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 4444
c:
	.zero	4444
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 4444
d:
	.zero	4444
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 1332
p:
	.zero	1332
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	y
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.zero	4
	.globl	z
	.align 4
	.type	z, @object
	.size	z, 4
z:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d%d"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d%d%d"
	.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
	jmp	.L2
.L21:
	movl	$332, i(%rip)
	jmp	.L3
.L4:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	$2, (%rdx,%rax)
.L3:
	movl	i(%rip), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$0, i(%rip)
	leaq	p(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L5
.L6:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	leaq	(%rdx,%rax), %rsi
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdi
	leaq	a(%rip), %rax
	addq	%rdi, %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
.L5:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	p(%rip), %edx
	cmpl	%edx, %eax
	jl	.L6
	movl	$0, i(%rip)
	jmp	.L7
.L17:
	movl	$0, j(%rip)
	jmp	.L8
.L16:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L9
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rax
	movl	$1, (%rcx,%rax)
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movslq	%eax, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	p(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L8
.L9:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	$1, %eax
	movl	%eax, x(%rip)
	movl	x(%rip), %ecx
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	$1, %eax
	movl	%eax, y(%rip)
	movl	y(%rip), %eax
	andl	%ecx, %eax
	testl	%eax, %eax
	je	.L10
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L8
.L10:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, z(%rip)
	movl	z(%rip), %edx
	movl	x(%rip), %eax
	andl	%edx, %eax
	testl	%eax, %eax
	je	.L12
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L8
.L12:
	movl	y(%rip), %edx
	movl	z(%rip), %eax
	andl	%edx, %eax
	testl	%eax, %eax
	je	.L8
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	$0, (%rdx,%rax)
.L8:
	movl	j(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, j(%rip)
	movl	p(%rip), %edx
	cmpl	%edx, %eax
	jl	.L16
.L7:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	p(%rip), %edx
	cmpl	%edx, %eax
	jl	.L17
	movl	$0, i(%rip)
	jmp	.L18
.L19:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L18:
	movl	a(%rip), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jg	.L19
.L2:
	leaq	c(%rip), %rax
	movq	%rax, %rcx
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	testl	%eax, %eax
	je	.L20
	movl	a(%rip), %eax
	movl	b(%rip), %ecx
	movl	c(%rip), %edx
	addl	%ecx, %edx
	addl	%edx, %eax
	movl	%eax, a(%rip)
	movl	a(%rip), %eax
	testl	%eax, %eax
	jne	.L21
.L20:
	movl	$0, %eax
	popq	%rbp
	.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:
