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

int main(void){
	int a,b,c,d,e,check;
	int *Ans,*da,*db,*dc;
	while(1){
	scanf("%d %d %d",&a,&b,&c);
	if(a==0 && b==0 && c==0)break;
	Ans=(int*)malloc(sizeof(int)*(a+b+c+1));
	for(e=1;e<=a+b+c;e++){
		Ans[e]=2;
	}
	scanf("%d",&d);
	da=(int*)malloc(sizeof(int)*(d));
	db=(int*)malloc(sizeof(int)*(d));
	dc=(int*)malloc(sizeof(int)*(d));
	for(e=0;e<d;e++){
		scanf("%d %d %d %d",&da[e],&db[e],&dc[e],&check);
		if(check==1)Ans[da[e]]=1,Ans[db[e]]=1,Ans[dc[e]]=1;
	}
	back:
	for(e=0;e<d;e++){
		   check=0;
		   if(Ans[da[e]]==1)check+=1;
		   if(Ans[db[e]]==1)check+=1;
		   if(Ans[dc[e]]==1)check+=1;
		   if(check==2){
		   	 if(Ans[da[e]]==2){
			 	Ans[da[e]]=0;
				goto back;
			 }
		  	 if(Ans[db[e]]==2){
			 	Ans[db[e]]=0;
				goto back;
			 }
		 	 if(Ans[dc[e]]==2){
			 	Ans[dc[e]]=0;
				goto back;
		   	 }
		}
	}
	free(da);
	free(db);
	free(dc);
	for(e=1;e<=a+b+c;e++){
		printf("%d\n",Ans[e]);
	}
	}
	return 0;
} ```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d %d %d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L20:
	leaq	-56(%rbp), %rcx
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-60(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-56(%rbp), %eax
	testl	%eax, %eax
	je	.L24
.L2:
	movl	-64(%rbp), %edx
	movl	-60(%rbp), %eax
	addl	%eax, %edx
	movl	-56(%rbp), %eax
	addl	%edx, %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movl	$1, -44(%rbp)
	jmp	.L4
.L5:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$2, (%rax)
	addl	$1, -44(%rbp)
.L4:
	movl	-64(%rbp), %edx
	movl	-60(%rbp), %eax
	addl	%eax, %edx
	movl	-56(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -44(%rbp)
	jle	.L5
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L6
.L8:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	leaq	-48(%rbp), %rsi
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	cmpl	$1, %eax
	jne	.L7
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
.L7:
	addl	$1, -44(%rbp)
.L6:
	movl	-52(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L8
	nop
.L9:
	movl	$0, -44(%rbp)
	jmp	.L10
.L17:
	movl	$0, -48(%rbp)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L11
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
.L11:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L12
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
.L12:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L13
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
.L13:
	movl	-48(%rbp), %eax
	cmpl	$2, %eax
	jne	.L14
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$2, %eax
	jne	.L15
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	jmp	.L9
.L15:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$2, %eax
	jne	.L16
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	jmp	.L9
.L16:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$2, %eax
	jne	.L14
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	jmp	.L9
.L14:
	addl	$1, -44(%rbp)
.L10:
	movl	-52(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L17
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$1, -44(%rbp)
	jmp	.L18
.L19:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -44(%rbp)
.L18:
	movl	-64(%rbp), %edx
	movl	-60(%rbp), %eax
	addl	%eax, %edx
	movl	-56(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -44(%rbp)
	jle	.L19
	jmp	.L20
.L24:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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 %d"
.LC1:
	.string	"%d"
.LC3:
	.string	"%d %d %d %d"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	60(%rsp), %rax
	movq	%rax, 40(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 32(%rsp)
	leaq	52(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L27:
	movq	40(%rsp), %rcx
	movq	32(%rsp), %rdx
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	movq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %ebp
	movl	56(%rsp), %ecx
	movl	60(%rsp), %edx
	movl	%ebp, %eax
	orl	%ecx, %eax
	orl	%edx, %eax
	je	.L2
	addl	%ecx, %ebp
	addl	%edx, %ebp
	leal	1(%rbp), %edi
	movslq	%edi, %rdi
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	testl	%ebp, %ebp
	jle	.L9
	leal	-1(%rbp), %eax
	cmpl	$2, %eax
	jbe	.L31
	movl	%ebp, %edx
	leaq	4(%rbx), %rax
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%rbx,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L7:
	movdqa	.LC2(%rip), %xmm0
	addq	$16, %rax
	movups	%xmm0, -16(%rax)
	cmpq	%rax, %rdx
	jne	.L7
	movl	%ebp, %edx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%ebp, %edx
	je	.L9
.L6:
	movslq	%eax, %rdx
	movl	$2, (%rbx,%rdx,4)
	leaq	0(,%rdx,4), %rcx
	leal	1(%rax), %edx
	cmpl	%edx, %ebp
	jl	.L9
	addl	$2, %eax
	movl	$2, 4(%rbx,%rcx)
	cmpl	%eax, %ebp
	jl	.L9
	movl	$2, 8(%rbx,%rcx)
.L9:
	leaq	64(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	64(%rsp), %r13
	movq	%r13, %r14
	salq	$2, %r13
	movq	%r13, %rdi
	call	malloc@PLT
	movq	%r13, %rdi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%r13, %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	movq	%rax, %r13
	testl	%r14d, %r14d
	jle	.L11
	movq	%rax, 16(%rsp)
	movq	%r12, %rsi
	movq	%rbp, %rdx
	xorl	%r15d, %r15d
	leaq	68(%rsp), %r8
	movq	%r12, (%rsp)
	movq	%rdx, %r14
	movq	%rbx, %r12
	movq	%rbp, 8(%rsp)
	movq	%rax, %rbx
	movl	%r15d, %ebp
	movq	%r8, %r13
	movq	%rsi, %r15
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rbx, %rcx
	movq	%r13, %r8
	movq	%r14, %rdx
	movq	%r15, %rsi
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	68(%rsp), %ecx
	cmpl	$1, %ecx
	je	.L47
	movl	64(%rsp), %edi
	addl	$1, %ebp
	addq	$4, %r15
	addq	$4, %r14
	addq	$4, %rbx
	cmpl	%ebp, %edi
	jg	.L15
.L44:
	movq	%r12, %rbx
	movq	8(%rsp), %rbp
	movq	(%rsp), %r12
	xorl	%eax, %eax
	movq	16(%rsp), %r13
	movslq	%edi, %r15
.L16:
	testl	%edi, %edi
	jle	.L48
	xorl	%eax, %eax
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L19:
	movslq	0(%r13,%rax,4), %rsi
	leaq	(%rbx,%rsi,4), %r11
	cmpl	$1, (%r11)
	je	.L29
.L21:
	addq	$1, %rax
	cmpq	%rax, %r15
	je	.L45
.L25:
	movslq	(%r12,%rax,4), %rdx
	leaq	(%rbx,%rdx,4), %r9
	movslq	0(%rbp,%rax,4), %rdx
	movl	(%r9), %r8d
	leaq	(%rbx,%rdx,4), %r10
	cmpl	$1, %r8d
	movl	(%r10), %edx
	sete	%sil
	sete	%cl
	movzbl	%sil, %esi
	movzbl	%cl, %ecx
	addl	$1, %esi
	cmpl	$1, %edx
	jne	.L19
	movslq	0(%r13,%rax,4), %rcx
	leaq	(%rbx,%rcx,4), %r11
	movl	%esi, %ecx
	movl	(%r11), %r14d
	cmpl	$1, %r14d
	je	.L29
.L20:
	cmpl	$2, %ecx
	jne	.L21
	cmpl	$2, %r8d
	je	.L49
	cmpl	$2, %edx
	je	.L50
	cmpl	$2, %r14d
	jne	.L21
	movl	$0, (%r11)
.L23:
	movl	$1, %eax
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L29:
	addl	$1, %ecx
	movl	$1, %r14d
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L47:
	movslq	(%r15), %rax
	movl	64(%rsp), %edi
	addl	$1, %ebp
	addq	$4, %r15
	addq	$4, %r14
	addq	$4, %rbx
	movl	$1, (%r12,%rax,4)
	movslq	-4(%r14), %rax
	movl	$1, (%r12,%rax,4)
	movslq	-4(%rbx), %rax
	movl	$1, (%r12,%rax,4)
	cmpl	%edi, %ebp
	jl	.L15
	jmp	.L44
.L48:
	testb	%al, %al
	je	.L11
	.p2align 4,,10
	.p2align 3
.L45:
	movl	%ecx, 68(%rsp)
.L11:
	movq	%r12, %rdi
	movl	$1, %r12d
	call	free@PLT
	movq	%rbp, %rdi
	leaq	.LC4(%rip), %rbp
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movl	56(%rsp), %eax
	addl	52(%rsp), %eax
	addl	60(%rsp), %eax
	testl	%eax, %eax
	jle	.L27
	.p2align 4,,10
	.p2align 3
.L26:
	movl	(%rbx,%r12,4), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__printf_chk@PLT
	movl	56(%rsp), %eax
	addl	52(%rsp), %eax
	addl	60(%rsp), %eax
	cmpl	%r12d, %eax
	jge	.L26
	jmp	.L27
.L49:
	movl	$0, (%r9)
	jmp	.L23
.L50:
	movl	$0, (%r10)
	jmp	.L23
.L31:
	movl	$1, %eax
	jmp	.L6
.L2:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$88, %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
.L51:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.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
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d"
.LC3:
	.string	"%d %d %d %d"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	60(%rsp), %rax
	movq	%rax, 40(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 32(%rsp)
	leaq	52(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L27:
	movq	40(%rsp), %rcx
	movq	32(%rsp), %rdx
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	movq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %ebp
	movl	56(%rsp), %ecx
	movl	60(%rsp), %edx
	movl	%ebp, %eax
	orl	%ecx, %eax
	orl	%edx, %eax
	je	.L2
	addl	%ecx, %ebp
	addl	%edx, %ebp
	leal	1(%rbp), %edi
	movslq	%edi, %rdi
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	testl	%ebp, %ebp
	jle	.L9
	leal	-1(%rbp), %eax
	cmpl	$2, %eax
	jbe	.L31
	movl	%ebp, %edx
	leaq	4(%rbx), %rax
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%rbx,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L7:
	movdqa	.LC2(%rip), %xmm0
	addq	$16, %rax
	movups	%xmm0, -16(%rax)
	cmpq	%rax, %rdx
	jne	.L7
	movl	%ebp, %edx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%ebp, %edx
	je	.L9
.L6:
	movslq	%eax, %rdx
	movl	$2, (%rbx,%rdx,4)
	leaq	0(,%rdx,4), %rcx
	leal	1(%rax), %edx
	cmpl	%edx, %ebp
	jl	.L9
	addl	$2, %eax
	movl	$2, 4(%rbx,%rcx)
	cmpl	%eax, %ebp
	jl	.L9
	movl	$2, 8(%rbx,%rcx)
.L9:
	leaq	64(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	64(%rsp), %r13
	movq	%r13, %r14
	salq	$2, %r13
	movq	%r13, %rdi
	call	malloc@PLT
	movq	%r13, %rdi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%r13, %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	movq	%rax, %r13
	testl	%r14d, %r14d
	jle	.L11
	movq	%rax, 16(%rsp)
	movq	%r12, %rsi
	movq	%rbp, %rdx
	xorl	%r15d, %r15d
	leaq	68(%rsp), %r8
	movq	%r12, (%rsp)
	movq	%rdx, %r14
	movq	%rbx, %r12
	movq	%rbp, 8(%rsp)
	movq	%rax, %rbx
	movl	%r15d, %ebp
	movq	%r8, %r13
	movq	%rsi, %r15
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rbx, %rcx
	movq	%r13, %r8
	movq	%r14, %rdx
	movq	%r15, %rsi
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	68(%rsp), %ecx
	cmpl	$1, %ecx
	je	.L47
	movl	64(%rsp), %edi
	addl	$1, %ebp
	addq	$4, %r15
	addq	$4, %r14
	addq	$4, %rbx
	cmpl	%ebp, %edi
	jg	.L15
.L44:
	movq	%r12, %rbx
	movq	8(%rsp), %rbp
	movq	(%rsp), %r12
	xorl	%eax, %eax
	movq	16(%rsp), %r13
	movslq	%edi, %r15
.L16:
	testl	%edi, %edi
	jle	.L48
	xorl	%eax, %eax
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L19:
	movslq	0(%r13,%rax,4), %rsi
	leaq	(%rbx,%rsi,4), %r11
	cmpl	$1, (%r11)
	je	.L29
.L21:
	addq	$1, %rax
	cmpq	%rax, %r15
	je	.L45
.L25:
	movslq	(%r12,%rax,4), %rdx
	leaq	(%rbx,%rdx,4), %r9
	movslq	0(%rbp,%rax,4), %rdx
	movl	(%r9), %r8d
	leaq	(%rbx,%rdx,4), %r10
	cmpl	$1, %r8d
	movl	(%r10), %edx
	sete	%sil
	sete	%cl
	movzbl	%sil, %esi
	movzbl	%cl, %ecx
	addl	$1, %esi
	cmpl	$1, %edx
	jne	.L19
	movslq	0(%r13,%rax,4), %rcx
	leaq	(%rbx,%rcx,4), %r11
	movl	%esi, %ecx
	movl	(%r11), %r14d
	cmpl	$1, %r14d
	je	.L29
.L20:
	cmpl	$2, %ecx
	jne	.L21
	cmpl	$2, %r8d
	je	.L49
	cmpl	$2, %edx
	je	.L50
	cmpl	$2, %r14d
	jne	.L21
	movl	$0, (%r11)
.L23:
	movl	$1, %eax
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L29:
	addl	$1, %ecx
	movl	$1, %r14d
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L47:
	movslq	(%r15), %rax
	movl	64(%rsp), %edi
	addl	$1, %ebp
	addq	$4, %r15
	addq	$4, %r14
	addq	$4, %rbx
	movl	$1, (%r12,%rax,4)
	movslq	-4(%r14), %rax
	movl	$1, (%r12,%rax,4)
	movslq	-4(%rbx), %rax
	movl	$1, (%r12,%rax,4)
	cmpl	%edi, %ebp
	jl	.L15
	jmp	.L44
.L48:
	testb	%al, %al
	je	.L11
	.p2align 4,,10
	.p2align 3
.L45:
	movl	%ecx, 68(%rsp)
.L11:
	movq	%r12, %rdi
	movl	$1, %r12d
	call	free@PLT
	movq	%rbp, %rdi
	leaq	.LC4(%rip), %rbp
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movl	56(%rsp), %eax
	addl	52(%rsp), %eax
	addl	60(%rsp), %eax
	testl	%eax, %eax
	jle	.L27
	.p2align 4,,10
	.p2align 3
.L26:
	movl	(%rbx,%r12,4), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__printf_chk@PLT
	movl	56(%rsp), %eax
	addl	52(%rsp), %eax
	addl	60(%rsp), %eax
	cmpl	%r12d, %eax
	jge	.L26
	jmp	.L27
.L49:
	movl	$0, (%r9)
	jmp	.L23
.L50:
	movl	$0, (%r10)
	jmp	.L23
.L31:
	movl	$1, %eax
	jmp	.L6
.L2:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$88, %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
.L51:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.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:

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

int main(void){
	int a,b,c,d,e,check;
	int *Ans,*da,*db,*dc;
	while(1){
	scanf("%d %d %d",&a,&b,&c);
	if(a==0 && b==0 && c==0)break;
	Ans=(int*)malloc(sizeof(int)*(a+b+c+1));
	for(e=1;e<=a+b+c;e++){
		Ans[e]=2;
	}
	scanf("%d",&d);
	da=(int*)malloc(sizeof(int)*(d));
	db=(int*)malloc(sizeof(int)*(d));
	dc=(int*)malloc(sizeof(int)*(d));
	for(e=0;e<d;e++){
		scanf("%d %d %d %d",&da[e],&db[e],&dc[e],&check);
		if(check==1)Ans[da[e]]=1,Ans[db[e]]=1,Ans[dc[e]]=1;
	}
	back:
	for(e=0;e<d;e++){
		   check=0;
		   if(Ans[da[e]]==1)check+=1;
		   if(Ans[db[e]]==1)check+=1;
		   if(Ans[dc[e]]==1)check+=1;
		   if(check==2){
		   	 if(Ans[da[e]]==2){
			 	Ans[da[e]]=0;
				goto back;
			 }
		  	 if(Ans[db[e]]==2){
			 	Ans[db[e]]=0;
				goto back;
			 }
		 	 if(Ans[dc[e]]==2){
			 	Ans[dc[e]]=0;
				goto back;
		   	 }
		}
	}
	free(da);
	free(db);
	free(dc);
	for(e=1;e<=a+b+c;e++){
		printf("%d\n",Ans[e]);
	}
	}
	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
#include<stdio.h>
#include<stdlib.h>

int main(void){
	int a,b,c,d,e,check;
	int *Ans,*da,*db,*dc;
	while(1){
	scanf("%d %d %d",&a,&b,&c);
	if(a==0 && b==0 && c==0)break;
	Ans=(int*)malloc(sizeof(int)*(a+b+c+1));
	for(e=1;e<=a+b+c;e++){
		Ans[e]=2;
	}
	scanf("%d",&d);
	da=(int*)malloc(sizeof(int)*(d));
	db=(int*)malloc(sizeof(int)*(d));
	dc=(int*)malloc(sizeof(int)*(d));
	for(e=0;e<d;e++){
		scanf("%d %d %d %d",&da[e],&db[e],&dc[e],&check);
		if(check==1)Ans[da[e]]=1,Ans[db[e]]=1,Ans[dc[e]]=1;
	}
	back:
	for(e=0;e<d;e++){
		   check=0;
		   if(Ans[da[e]]==1)check+=1;
		   if(Ans[db[e]]==1)check+=1;
		   if(Ans[dc[e]]==1)check+=1;
		   if(check==2){
		   	 if(Ans[da[e]]==2){
			 	Ans[da[e]]=0;
				goto back;
			 }
		  	 if(Ans[db[e]]==2){
			 	Ans[db[e]]=0;
				goto back;
			 }
		 	 if(Ans[dc[e]]==2){
			 	Ans[dc[e]]=0;
				goto back;
		   	 }
		}
	}
	free(da);
	free(db);
	free(dc);
	for(e=1;e<=a+b+c;e++){
		printf("%d\n",Ans[e]);
	}
	}
	return 0;
} ```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d %d %d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L20:
	leaq	-56(%rbp), %rcx
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-60(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-56(%rbp), %eax
	testl	%eax, %eax
	je	.L24
.L2:
	movl	-64(%rbp), %edx
	movl	-60(%rbp), %eax
	addl	%eax, %edx
	movl	-56(%rbp), %eax
	addl	%edx, %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movl	$1, -44(%rbp)
	jmp	.L4
.L5:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$2, (%rax)
	addl	$1, -44(%rbp)
.L4:
	movl	-64(%rbp), %edx
	movl	-60(%rbp), %eax
	addl	%eax, %edx
	movl	-56(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -44(%rbp)
	jle	.L5
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L6
.L8:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	leaq	-48(%rbp), %rsi
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	cmpl	$1, %eax
	jne	.L7
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
.L7:
	addl	$1, -44(%rbp)
.L6:
	movl	-52(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L8
	nop
.L9:
	movl	$0, -44(%rbp)
	jmp	.L10
.L17:
	movl	$0, -48(%rbp)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L11
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
.L11:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L12
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
.L12:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L13
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
.L13:
	movl	-48(%rbp), %eax
	cmpl	$2, %eax
	jne	.L14
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$2, %eax
	jne	.L15
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	jmp	.L9
.L15:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$2, %eax
	jne	.L16
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	jmp	.L9
.L16:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$2, %eax
	jne	.L14
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	jmp	.L9
.L14:
	addl	$1, -44(%rbp)
.L10:
	movl	-52(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L17
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$1, -44(%rbp)
	jmp	.L18
.L19:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -44(%rbp)
.L18:
	movl	-64(%rbp), %edx
	movl	-60(%rbp), %eax
	addl	%eax, %edx
	movl	-56(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -44(%rbp)
	jle	.L19
	jmp	.L20
.L24:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d %d %d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L20:
	leaq	-56(%rbp), %rcx
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-60(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-56(%rbp), %eax
	testl	%eax, %eax
	je	.L24
.L2:
	movl	-64(%rbp), %edx
	movl	-60(%rbp), %eax
	addl	%eax, %edx
	movl	-56(%rbp), %eax
	addl	%edx, %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movl	$1, -44(%rbp)
	jmp	.L4
.L5:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$2, (%rax)
	addl	$1, -44(%rbp)
.L4:
	movl	-64(%rbp), %edx
	movl	-60(%rbp), %eax
	addl	%eax, %edx
	movl	-56(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -44(%rbp)
	jle	.L5
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L6
.L8:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	leaq	-48(%rbp), %rsi
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	cmpl	$1, %eax
	jne	.L7
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
.L7:
	addl	$1, -44(%rbp)
.L6:
	movl	-52(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L8
	nop
.L9:
	movl	$0, -44(%rbp)
	jmp	.L10
.L17:
	movl	$0, -48(%rbp)
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L11
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
.L11:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L12
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
.L12:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L13
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
.L13:
	movl	-48(%rbp), %eax
	cmpl	$2, %eax
	jne	.L14
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$2, %eax
	jne	.L15
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	jmp	.L9
.L15:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$2, %eax
	jne	.L16
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	jmp	.L9
.L16:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$2, %eax
	jne	.L14
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	jmp	.L9
.L14:
	addl	$1, -44(%rbp)
.L10:
	movl	-52(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L17
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$1, -44(%rbp)
	jmp	.L18
.L19:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -44(%rbp)
.L18:
	movl	-64(%rbp), %edx
	movl	-60(%rbp), %eax
	addl	%eax, %edx
	movl	-56(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -44(%rbp)
	jle	.L19
	jmp	.L20
.L24:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
