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 <math.h>
int main(void){
	int tab[10][400],a[10]={0,1,2,3,4,5,6,7,8,9},b[10]={0,0,0,0,0,0,0,0,0,0},sw[10]={1,1,1,1,1,1,1,1,1,1},sum,i,j,k,n,s;
	for(i=0;i<10;i++){for(j=0;j<400;j++){tab[i][j]=0;}}
	while(1){
		sum=0;
		for(i=0;i<10;i++){
			sum+=a[i]*(i+1);
			if(sw[i]==1){tab[i][sum]++;sw[i]=0;}
		}
		sw[9]=1;b[a[9]]=1;
		for(n=8;n>=0;n--){
			sw[n]=1;b[a[n]]=1;
			if(a[n]<a[n+1])break;
		}
		if(n<0)break;
		for(i=a[n]+1;i<10;i++){if(b[i]==1){a[n]=i;b[i]=0;break;}}
		for(i=0,n++;i<10&&n<10;i++){
			if(b[i]==1){a[n]=i;b[i]=0;n++;}
		}
	}
	while(scanf("%d %d",&n,&s)!=EOF){if(s>350)printf("0\n");else printf("%d\n",tab[n-1][s]);}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"0"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%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
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3904, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -16160(%rbp)
	movl	$1, -16156(%rbp)
	movl	$2, -16152(%rbp)
	movl	$3, -16148(%rbp)
	movl	$4, -16144(%rbp)
	movl	$5, -16140(%rbp)
	movl	$6, -16136(%rbp)
	movl	$7, -16132(%rbp)
	movl	$8, -16128(%rbp)
	movl	$9, -16124(%rbp)
	movq	$0, -16112(%rbp)
	movq	$0, -16104(%rbp)
	movq	$0, -16096(%rbp)
	movq	$0, -16088(%rbp)
	movq	$0, -16080(%rbp)
	movl	$1, -16064(%rbp)
	movl	$1, -16060(%rbp)
	movl	$1, -16056(%rbp)
	movl	$1, -16052(%rbp)
	movl	$1, -16048(%rbp)
	movl	$1, -16044(%rbp)
	movl	$1, -16040(%rbp)
	movl	$1, -16036(%rbp)
	movl	$1, -16032(%rbp)
	movl	$1, -16028(%rbp)
	movl	$0, -16168(%rbp)
	jmp	.L2
.L5:
	movl	$0, -16164(%rbp)
	jmp	.L3
.L4:
	movl	-16164(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16168(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	movl	$0, -16016(%rbp,%rax,4)
	addl	$1, -16164(%rbp)
.L3:
	cmpl	$399, -16164(%rbp)
	jle	.L4
	addl	$1, -16168(%rbp)
.L2:
	cmpl	$9, -16168(%rbp)
	jle	.L5
.L23:
	movl	$0, -16172(%rbp)
	movl	$0, -16168(%rbp)
	jmp	.L6
.L8:
	movl	-16168(%rbp), %eax
	cltq
	movl	-16160(%rbp,%rax,4), %eax
	movl	-16168(%rbp), %edx
	addl	$1, %edx
	imull	%edx, %eax
	addl	%eax, -16172(%rbp)
	movl	-16168(%rbp), %eax
	cltq
	movl	-16064(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L7
	movl	-16172(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16168(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	movl	-16016(%rbp,%rax,4), %eax
	leal	1(%rax), %ecx
	movl	-16172(%rbp), %eax
	movslq	%eax, %rsi
	movl	-16168(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rsi, %rax
	movl	%ecx, -16016(%rbp,%rax,4)
	movl	-16168(%rbp), %eax
	cltq
	movl	$0, -16064(%rbp,%rax,4)
.L7:
	addl	$1, -16168(%rbp)
.L6:
	cmpl	$9, -16168(%rbp)
	jle	.L8
	movl	$1, -16028(%rbp)
	movl	-16124(%rbp), %eax
	cltq
	movl	$1, -16112(%rbp,%rax,4)
	movl	$8, -16180(%rbp)
	jmp	.L9
.L12:
	movl	-16180(%rbp), %eax
	cltq
	movl	$1, -16064(%rbp,%rax,4)
	movl	-16180(%rbp), %eax
	cltq
	movl	-16160(%rbp,%rax,4), %eax
	cltq
	movl	$1, -16112(%rbp,%rax,4)
	movl	-16180(%rbp), %eax
	cltq
	movl	-16160(%rbp,%rax,4), %edx
	movl	-16180(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-16160(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jl	.L30
	movl	-16180(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -16180(%rbp)
.L9:
	movl	-16180(%rbp), %eax
	testl	%eax, %eax
	jns	.L12
	jmp	.L11
.L30:
	nop
.L11:
	movl	-16180(%rbp), %eax
	testl	%eax, %eax
	js	.L31
	movl	-16180(%rbp), %eax
	cltq
	movl	-16160(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, -16168(%rbp)
	jmp	.L15
.L18:
	movl	-16168(%rbp), %eax
	cltq
	movl	-16112(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-16180(%rbp), %eax
	cltq
	movl	-16168(%rbp), %edx
	movl	%edx, -16160(%rbp,%rax,4)
	movl	-16168(%rbp), %eax
	cltq
	movl	$0, -16112(%rbp,%rax,4)
	jmp	.L17
.L16:
	addl	$1, -16168(%rbp)
.L15:
	cmpl	$9, -16168(%rbp)
	jle	.L18
.L17:
	movl	$0, -16168(%rbp)
	movl	-16180(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16180(%rbp)
	jmp	.L19
.L22:
	movl	-16168(%rbp), %eax
	cltq
	movl	-16112(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L20
	movl	-16180(%rbp), %eax
	cltq
	movl	-16168(%rbp), %edx
	movl	%edx, -16160(%rbp,%rax,4)
	movl	-16168(%rbp), %eax
	cltq
	movl	$0, -16112(%rbp,%rax,4)
	movl	-16180(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16180(%rbp)
.L20:
	addl	$1, -16168(%rbp)
.L19:
	cmpl	$9, -16168(%rbp)
	jg	.L23
	movl	-16180(%rbp), %eax
	cmpl	$9, %eax
	jle	.L22
	jmp	.L23
.L31:
	nop
	jmp	.L24
.L26:
	movl	-16176(%rbp), %eax
	cmpl	$350, %eax
	jle	.L25
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L24
.L25:
	movl	-16180(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-16176(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	movl	-16016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L24:
	leaq	-16176(%rbp), %rdx
	leaq	-16180(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L26
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	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
.LC3:
	.string	"0"
.LC4:
	.string	"%d\n"
.LC5:
	.string	"%d %d"
	.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
	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	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 12344
	orq	$0, (%rsp)
	subq	$3864, %rsp
	.cfi_def_cfa_offset 16208
	movdqa	.LC0(%rip), %xmm0
	movl	$16000, %edx
	xorl	%esi, %esi
	movl	$1, %r12d
	movl	$1, %ebp
	movl	$1, %ebx
	movl	$7, %r15d
	movl	$3, %r14d
	movl	$1, %r13d
	movq	%fs:40, %rax
	movq	%rax, 16136(%rsp)
	xorl	%eax, %eax
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movq	.LC2(%rip), %rax
	leaq	128(%rsp), %rdi
	movq	$0, 112(%rsp)
	movaps	%xmm0, 48(%rsp)
	pxor	%xmm0, %xmm0
	movq	%rax, 64(%rsp)
	movaps	%xmm0, 80(%rsp)
	movaps	%xmm0, 96(%rsp)
	call	memset@PLT
	movl	$1, (%rsp)
	xorl	%r10d, %r10d
	movl	$9, %eax
	movl	$1, 4(%rsp)
	movl	$5, %edi
	movl	$4, %esi
	movl	$8, %r9d
	movl	$6, %r8d
	movl	$2, %ecx
	movl	$8, %edx
	movl	$1, 8(%rsp)
	movl	$1, 12(%rsp)
	movl	$1, %r11d
.L16:
	cmpl	$1, %r11d
	jne	.L2
	movslq	%r10d, %r11
	addl	$1, 128(%rsp,%r11,4)
.L2:
	leal	(%r10,%r13,2), %r10d
	cmpl	$1, %ebx
	jne	.L3
	movslq	%r10d, %r11
	addl	$1, 1728(%rsp,%r11,4)
.L3:
	leal	(%rcx,%rcx,2), %ecx
	addl	%r10d, %ecx
	cmpl	$1, 12(%rsp)
	jne	.L4
	movslq	%ecx, %r10
	addl	$1, 3328(%rsp,%r10,4)
.L4:
	cmpl	$1, 8(%rsp)
	leal	(%rcx,%r14,4), %r10d
	jne	.L5
	movslq	%r10d, %rcx
	addl	$1, 4928(%rsp,%rcx,4)
.L5:
	leal	(%rsi,%rsi,4), %ecx
	addl	%r10d, %ecx
	cmpl	$1, 4(%rsp)
	jne	.L6
	movslq	%ecx, %rsi
	addl	$1, 6528(%rsp,%rsi,4)
.L6:
	leal	(%rdi,%rdi,2), %esi
	cmpl	$1, (%rsp)
	leal	(%rcx,%rsi,2), %ecx
	jne	.L7
	movslq	%ecx, %rsi
	addl	$1, 8128(%rsp,%rsi,4)
.L7:
	leal	(%rcx,%r8,8), %ecx
	subl	%r8d, %ecx
	cmpl	$1, %ebp
	jne	.L8
	movslq	%ecx, %rsi
	addl	$1, 9728(%rsp,%rsi,4)
.L8:
	leal	(%rcx,%r15,8), %esi
	cmpl	$1, %r12d
	jne	.L9
	movslq	%esi, %rcx
	addl	$1, 11328(%rsp,%rcx,4)
.L9:
	leal	(%r9,%r9,8), %ecx
	movl	$1, 80(%rsp,%rax,4)
	addl	%esi, %ecx
	movslq	%ecx, %rsi
	addl	$1, 12928(%rsp,%rsi,4)
	leal	(%rax,%rax,4), %esi
	movl	%edx, %eax
	leal	(%rcx,%rsi,2), %ecx
	movslq	%ecx, %rcx
	addl	$1, 14528(%rsp,%rcx,4)
	movslq	%edx, %rcx
	movl	$1, 80(%rsp,%rcx,4)
	cmpl	%edx, 68(%rsp)
	jg	.L31
	movslq	60(%rsp), %rax
	movl	$1, 80(%rsp,%rax,4)
	movq	%rax, %rcx
	cmpl	%edx, %eax
	jl	.L32
	movslq	56(%rsp), %rdx
	movl	$1, 80(%rsp,%rdx,4)
	movq	%rdx, %rax
	cmpl	%ecx, %edx
	jl	.L33
	movslq	52(%rsp), %rcx
	movl	$1, 80(%rsp,%rcx,4)
	movq	%rcx, %rdx
	cmpl	%ecx, %eax
	jg	.L34
	movslq	48(%rsp), %rcx
	movl	$1, 80(%rsp,%rcx,4)
	movq	%rcx, %rax
	cmpl	%ecx, %edx
	jg	.L35
	movslq	44(%rsp), %rcx
	movl	$1, 80(%rsp,%rcx,4)
	movq	%rcx, %rdx
	cmpl	%eax, %ecx
	jl	.L36
	movslq	40(%rsp), %rcx
	movl	$1, 80(%rsp,%rcx,4)
	movq	%rcx, %rax
	cmpl	%ecx, %edx
	jg	.L37
	movslq	36(%rsp), %rcx
	movl	$1, 80(%rsp,%rcx,4)
	movq	%rcx, %rdx
	cmpl	%ecx, %eax
	jg	.L38
	movslq	32(%rsp), %rcx
	movl	$1, 80(%rsp,%rcx,4)
	movq	%rcx, %rax
	cmpl	%edx, %ecx
	jl	.L39
	movl	$-1, 24(%rsp)
	leaq	28(%rsp), %r12
	leaq	24(%rsp), %rbp
	leaq	.LC5(%rip), %rbx
	leaq	.LC4(%rip), %r14
	leaq	.LC3(%rip), %r13
.L11:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L69
	movslq	28(%rsp), %rax
	cmpl	$350, %eax
	jle	.L27
	movq	%r13, %rdi
	call	puts@PLT
	jmp	.L11
.L27:
	movl	24(%rsp), %edi
	movq	%r14, %rsi
	leal	-1(%rdi), %edx
	movl	$1, %edi
	movslq	%edx, %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	movl	128(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L11
.L69:
	movq	16136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L70
	addq	$16152, %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
.L31:
	.cfi_restore_state
	movl	$0, (%rsp)
	xorl	%r12d, %r12d
	xorl	%ebp, %ebp
	xorl	%ebx, %ebx
	movl	$0, 4(%rsp)
	xorl	%r11d, %r11d
	movl	$8, %edi
	movl	$9, %esi
	movl	$0, 8(%rsp)
	movl	$0, 12(%rsp)
.L10:
	leal	1(%rax), %edx
	cmpl	$9, %edx
	jg	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	2(%rax), %edx
	cmpl	$8, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	3(%rax), %edx
	cmpl	$7, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	4(%rax), %edx
	cmpl	$6, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	5(%rax), %edx
	cmpl	$5, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	6(%rax), %edx
	cmpl	$4, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	7(%rax), %edx
	cmpl	$3, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	8(%rax), %edx
	cmpl	$2, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	9(%rax), %edx
	cmpl	$1, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	10(%rax), %edx
	testl	%eax, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
.L12:
	cmpl	$1, 80(%rsp)
	je	.L71
.L15:
	cmpl	$1, 84(%rsp)
	je	.L72
.L18:
	cmpl	$1, 88(%rsp)
	je	.L73
.L19:
	cmpl	$1, 92(%rsp)
	je	.L74
.L20:
	cmpl	$1, 96(%rsp)
	je	.L75
.L21:
	cmpl	$1, 100(%rsp)
	je	.L76
.L22:
	cmpl	$1, 104(%rsp)
	je	.L77
.L23:
	cmpl	$1, 108(%rsp)
	je	.L78
.L24:
	cmpl	$1, 112(%rsp)
	je	.L79
.L25:
	cmpl	$1, 116(%rsp)
	jne	.L17
	movslq	%esi, %rsi
	movl	$0, 116(%rsp)
	movl	$9, 32(%rsp,%rsi,4)
.L17:
	movl	64(%rsp), %edx
	movl	32(%rsp), %r10d
	movl	36(%rsp), %r13d
	movl	40(%rsp), %ecx
	movl	44(%rsp), %r14d
	movl	48(%rsp), %esi
	movl	%edx, %r9d
	movl	52(%rsp), %edi
	movl	56(%rsp), %r8d
	movl	60(%rsp), %r15d
	movslq	68(%rsp), %rax
	jmp	.L16
.L13:
	movl	$0, 80(%rsp,%rcx,4)
	cmpl	$1, 80(%rsp)
	movl	%edx, 32(%rsp,%rdi,4)
	jne	.L15
.L71:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 80(%rsp)
	movl	$0, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 84(%rsp)
	jne	.L18
.L72:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 84(%rsp)
	movl	$1, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 88(%rsp)
	jne	.L19
.L73:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 88(%rsp)
	movl	$2, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 92(%rsp)
	jne	.L20
.L74:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 92(%rsp)
	movl	$3, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 96(%rsp)
	jne	.L21
.L75:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 96(%rsp)
	movl	$4, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 100(%rsp)
	jne	.L22
.L76:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 100(%rsp)
	movl	$5, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 104(%rsp)
	jne	.L23
.L77:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 104(%rsp)
	movl	$6, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 108(%rsp)
	jne	.L24
.L78:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 108(%rsp)
	movl	$7, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 112(%rsp)
	jne	.L25
.L79:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 112(%rsp)
	movl	$8, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jle	.L25
	jmp	.L17
.L32:
	movl	$0, (%rsp)
	xorl	%ebp, %ebp
	xorl	%ebx, %ebx
	xorl	%r11d, %r11d
	movl	$1, %r12d
	movl	$7, %edi
	movl	$8, %esi
	movl	$0, 4(%rsp)
	movl	$0, 8(%rsp)
	movl	$0, 12(%rsp)
	jmp	.L10
.L37:
	movl	$1, (%rsp)
	movl	$1, %r12d
	xorl	%ebx, %ebx
	xorl	%r11d, %r11d
	movl	$1, %ebp
	movl	$2, %edi
	movl	$3, %esi
	movl	$1, 4(%rsp)
	movl	$1, 8(%rsp)
	movl	$1, 12(%rsp)
	jmp	.L10
.L36:
	movl	$1, (%rsp)
	movl	%ecx, %eax
	movl	$1, %ebp
	xorl	%ebx, %ebx
	movl	$1, 4(%rsp)
	movl	$1, %r12d
	xorl	%r11d, %r11d
	movl	$3, %edi
	movl	$1, 8(%rsp)
	movl	$4, %esi
	movl	$0, 12(%rsp)
	jmp	.L10
.L35:
	movl	$1, (%rsp)
	movl	$1, %r12d
	xorl	%ebx, %ebx
	xorl	%r11d, %r11d
	movl	$1, %ebp
	movl	$4, %edi
	movl	$5, %esi
	movl	$1, 4(%rsp)
	movl	$0, 8(%rsp)
	movl	$0, 12(%rsp)
	jmp	.L10
.L34:
	movl	$1, (%rsp)
	movl	%ecx, %eax
	movl	$1, %ebp
	xorl	%ebx, %ebx
	movl	$0, 4(%rsp)
	movl	$1, %r12d
	xorl	%r11d, %r11d
	movl	$5, %edi
	movl	$0, 8(%rsp)
	movl	$6, %esi
	movl	$0, 12(%rsp)
	jmp	.L10
.L33:
	movl	$0, (%rsp)
	movl	$1, %r12d
	xorl	%ebx, %ebx
	xorl	%r11d, %r11d
	movl	$1, %ebp
	movl	$6, %edi
	movl	$7, %esi
	movl	$0, 4(%rsp)
	movl	$0, 8(%rsp)
	movl	$0, 12(%rsp)
	jmp	.L10
.L38:
	movl	$1, (%rsp)
	movl	%ecx, %eax
	xorl	%r11d, %r11d
	movl	$1, %r12d
	movl	$1, %ebp
	movl	$1, %ebx
	movl	$1, %edi
	movl	$1, 4(%rsp)
	movl	$1, 8(%rsp)
	movl	$2, %esi
	movl	$1, 12(%rsp)
	jmp	.L10
.L39:
	movl	$1, (%rsp)
	movl	$1, %r12d
	xorl	%edi, %edi
	movl	$1, %ebp
	movl	$1, %ebx
	movl	$1, %r11d
	movl	$1, %esi
	movl	$1, 4(%rsp)
	movl	$1, 8(%rsp)
	movl	$1, 12(%rsp)
	jmp	.L10
.L70:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC1:
	.long	4
	.long	5
	.long	6
	.long	7
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC2:
	.long	8
	.long	9
	.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
.LC3:
	.string	"0"
.LC4:
	.string	"%d\n"
.LC5:
	.string	"%d %d"
	.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
	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	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 12344
	orq	$0, (%rsp)
	subq	$3864, %rsp
	.cfi_def_cfa_offset 16208
	movdqa	.LC0(%rip), %xmm0
	movl	$16000, %edx
	xorl	%esi, %esi
	movl	$1, %r12d
	movl	$1, %ebp
	movl	$1, %ebx
	movl	$7, %r15d
	movl	$3, %r14d
	movl	$1, %r13d
	movq	%fs:40, %rax
	movq	%rax, 16136(%rsp)
	xorl	%eax, %eax
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movq	.LC2(%rip), %rax
	leaq	128(%rsp), %rdi
	movq	$0, 112(%rsp)
	movaps	%xmm0, 48(%rsp)
	pxor	%xmm0, %xmm0
	movq	%rax, 64(%rsp)
	movaps	%xmm0, 80(%rsp)
	movaps	%xmm0, 96(%rsp)
	call	memset@PLT
	movl	$1, (%rsp)
	xorl	%r10d, %r10d
	movl	$9, %eax
	movl	$1, 4(%rsp)
	movl	$5, %edi
	movl	$4, %esi
	movl	$8, %r9d
	movl	$6, %r8d
	movl	$2, %ecx
	movl	$8, %edx
	movl	$1, 8(%rsp)
	movl	$1, 12(%rsp)
	movl	$1, %r11d
.L16:
	cmpl	$1, %r11d
	jne	.L2
	movslq	%r10d, %r11
	addl	$1, 128(%rsp,%r11,4)
.L2:
	leal	(%r10,%r13,2), %r10d
	cmpl	$1, %ebx
	jne	.L3
	movslq	%r10d, %r11
	addl	$1, 1728(%rsp,%r11,4)
.L3:
	leal	(%rcx,%rcx,2), %ecx
	addl	%r10d, %ecx
	cmpl	$1, 12(%rsp)
	jne	.L4
	movslq	%ecx, %r10
	addl	$1, 3328(%rsp,%r10,4)
.L4:
	cmpl	$1, 8(%rsp)
	leal	(%rcx,%r14,4), %r10d
	jne	.L5
	movslq	%r10d, %rcx
	addl	$1, 4928(%rsp,%rcx,4)
.L5:
	leal	(%rsi,%rsi,4), %ecx
	addl	%r10d, %ecx
	cmpl	$1, 4(%rsp)
	jne	.L6
	movslq	%ecx, %rsi
	addl	$1, 6528(%rsp,%rsi,4)
.L6:
	leal	(%rdi,%rdi,2), %esi
	cmpl	$1, (%rsp)
	leal	(%rcx,%rsi,2), %ecx
	jne	.L7
	movslq	%ecx, %rsi
	addl	$1, 8128(%rsp,%rsi,4)
.L7:
	leal	(%rcx,%r8,8), %ecx
	subl	%r8d, %ecx
	cmpl	$1, %ebp
	jne	.L8
	movslq	%ecx, %rsi
	addl	$1, 9728(%rsp,%rsi,4)
.L8:
	leal	(%rcx,%r15,8), %esi
	cmpl	$1, %r12d
	jne	.L9
	movslq	%esi, %rcx
	addl	$1, 11328(%rsp,%rcx,4)
.L9:
	leal	(%r9,%r9,8), %ecx
	movl	$1, 80(%rsp,%rax,4)
	addl	%esi, %ecx
	movslq	%ecx, %rsi
	addl	$1, 12928(%rsp,%rsi,4)
	leal	(%rax,%rax,4), %esi
	movl	%edx, %eax
	leal	(%rcx,%rsi,2), %ecx
	movslq	%ecx, %rcx
	addl	$1, 14528(%rsp,%rcx,4)
	movslq	%edx, %rcx
	movl	$1, 80(%rsp,%rcx,4)
	cmpl	%edx, 68(%rsp)
	jg	.L31
	movslq	60(%rsp), %rax
	movl	$1, 80(%rsp,%rax,4)
	movq	%rax, %rcx
	cmpl	%edx, %eax
	jl	.L32
	movslq	56(%rsp), %rdx
	movl	$1, 80(%rsp,%rdx,4)
	movq	%rdx, %rax
	cmpl	%ecx, %edx
	jl	.L33
	movslq	52(%rsp), %rcx
	movl	$1, 80(%rsp,%rcx,4)
	movq	%rcx, %rdx
	cmpl	%ecx, %eax
	jg	.L34
	movslq	48(%rsp), %rcx
	movl	$1, 80(%rsp,%rcx,4)
	movq	%rcx, %rax
	cmpl	%ecx, %edx
	jg	.L35
	movslq	44(%rsp), %rcx
	movl	$1, 80(%rsp,%rcx,4)
	movq	%rcx, %rdx
	cmpl	%eax, %ecx
	jl	.L36
	movslq	40(%rsp), %rcx
	movl	$1, 80(%rsp,%rcx,4)
	movq	%rcx, %rax
	cmpl	%ecx, %edx
	jg	.L37
	movslq	36(%rsp), %rcx
	movl	$1, 80(%rsp,%rcx,4)
	movq	%rcx, %rdx
	cmpl	%ecx, %eax
	jg	.L38
	movslq	32(%rsp), %rcx
	movl	$1, 80(%rsp,%rcx,4)
	movq	%rcx, %rax
	cmpl	%edx, %ecx
	jl	.L39
	movl	$-1, 24(%rsp)
	leaq	28(%rsp), %r12
	leaq	24(%rsp), %rbp
	leaq	.LC5(%rip), %rbx
	leaq	.LC4(%rip), %r14
	leaq	.LC3(%rip), %r13
.L11:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L69
	movslq	28(%rsp), %rax
	cmpl	$350, %eax
	jle	.L27
	movq	%r13, %rdi
	call	puts@PLT
	jmp	.L11
.L27:
	movl	24(%rsp), %edi
	movq	%r14, %rsi
	leal	-1(%rdi), %edx
	movl	$1, %edi
	movslq	%edx, %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	movl	128(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L11
.L69:
	movq	16136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L70
	addq	$16152, %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
.L31:
	.cfi_restore_state
	movl	$0, (%rsp)
	xorl	%r12d, %r12d
	xorl	%ebp, %ebp
	xorl	%ebx, %ebx
	movl	$0, 4(%rsp)
	xorl	%r11d, %r11d
	movl	$8, %edi
	movl	$9, %esi
	movl	$0, 8(%rsp)
	movl	$0, 12(%rsp)
.L10:
	leal	1(%rax), %edx
	cmpl	$9, %edx
	jg	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	2(%rax), %edx
	cmpl	$8, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	3(%rax), %edx
	cmpl	$7, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	4(%rax), %edx
	cmpl	$6, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	5(%rax), %edx
	cmpl	$5, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	6(%rax), %edx
	cmpl	$4, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	7(%rax), %edx
	cmpl	$3, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	8(%rax), %edx
	cmpl	$2, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	9(%rax), %edx
	cmpl	$1, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
	leal	10(%rax), %edx
	testl	%eax, %eax
	je	.L12
	movslq	%edx, %rcx
	cmpl	$1, 80(%rsp,%rcx,4)
	je	.L13
.L12:
	cmpl	$1, 80(%rsp)
	je	.L71
.L15:
	cmpl	$1, 84(%rsp)
	je	.L72
.L18:
	cmpl	$1, 88(%rsp)
	je	.L73
.L19:
	cmpl	$1, 92(%rsp)
	je	.L74
.L20:
	cmpl	$1, 96(%rsp)
	je	.L75
.L21:
	cmpl	$1, 100(%rsp)
	je	.L76
.L22:
	cmpl	$1, 104(%rsp)
	je	.L77
.L23:
	cmpl	$1, 108(%rsp)
	je	.L78
.L24:
	cmpl	$1, 112(%rsp)
	je	.L79
.L25:
	cmpl	$1, 116(%rsp)
	jne	.L17
	movslq	%esi, %rsi
	movl	$0, 116(%rsp)
	movl	$9, 32(%rsp,%rsi,4)
.L17:
	movl	64(%rsp), %edx
	movl	32(%rsp), %r10d
	movl	36(%rsp), %r13d
	movl	40(%rsp), %ecx
	movl	44(%rsp), %r14d
	movl	48(%rsp), %esi
	movl	%edx, %r9d
	movl	52(%rsp), %edi
	movl	56(%rsp), %r8d
	movl	60(%rsp), %r15d
	movslq	68(%rsp), %rax
	jmp	.L16
.L13:
	movl	$0, 80(%rsp,%rcx,4)
	cmpl	$1, 80(%rsp)
	movl	%edx, 32(%rsp,%rdi,4)
	jne	.L15
.L71:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 80(%rsp)
	movl	$0, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 84(%rsp)
	jne	.L18
.L72:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 84(%rsp)
	movl	$1, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 88(%rsp)
	jne	.L19
.L73:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 88(%rsp)
	movl	$2, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 92(%rsp)
	jne	.L20
.L74:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 92(%rsp)
	movl	$3, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 96(%rsp)
	jne	.L21
.L75:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 96(%rsp)
	movl	$4, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 100(%rsp)
	jne	.L22
.L76:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 100(%rsp)
	movl	$5, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 104(%rsp)
	jne	.L23
.L77:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 104(%rsp)
	movl	$6, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 108(%rsp)
	jne	.L24
.L78:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 108(%rsp)
	movl	$7, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jg	.L17
	cmpl	$1, 112(%rsp)
	jne	.L25
.L79:
	movslq	%esi, %rax
	addl	$1, %esi
	movl	$0, 112(%rsp)
	movl	$8, 32(%rsp,%rax,4)
	cmpl	$9, %esi
	jle	.L25
	jmp	.L17
.L32:
	movl	$0, (%rsp)
	xorl	%ebp, %ebp
	xorl	%ebx, %ebx
	xorl	%r11d, %r11d
	movl	$1, %r12d
	movl	$7, %edi
	movl	$8, %esi
	movl	$0, 4(%rsp)
	movl	$0, 8(%rsp)
	movl	$0, 12(%rsp)
	jmp	.L10
.L37:
	movl	$1, (%rsp)
	movl	$1, %r12d
	xorl	%ebx, %ebx
	xorl	%r11d, %r11d
	movl	$1, %ebp
	movl	$2, %edi
	movl	$3, %esi
	movl	$1, 4(%rsp)
	movl	$1, 8(%rsp)
	movl	$1, 12(%rsp)
	jmp	.L10
.L36:
	movl	$1, (%rsp)
	movl	%ecx, %eax
	movl	$1, %ebp
	xorl	%ebx, %ebx
	movl	$1, 4(%rsp)
	movl	$1, %r12d
	xorl	%r11d, %r11d
	movl	$3, %edi
	movl	$1, 8(%rsp)
	movl	$4, %esi
	movl	$0, 12(%rsp)
	jmp	.L10
.L35:
	movl	$1, (%rsp)
	movl	$1, %r12d
	xorl	%ebx, %ebx
	xorl	%r11d, %r11d
	movl	$1, %ebp
	movl	$4, %edi
	movl	$5, %esi
	movl	$1, 4(%rsp)
	movl	$0, 8(%rsp)
	movl	$0, 12(%rsp)
	jmp	.L10
.L34:
	movl	$1, (%rsp)
	movl	%ecx, %eax
	movl	$1, %ebp
	xorl	%ebx, %ebx
	movl	$0, 4(%rsp)
	movl	$1, %r12d
	xorl	%r11d, %r11d
	movl	$5, %edi
	movl	$0, 8(%rsp)
	movl	$6, %esi
	movl	$0, 12(%rsp)
	jmp	.L10
.L33:
	movl	$0, (%rsp)
	movl	$1, %r12d
	xorl	%ebx, %ebx
	xorl	%r11d, %r11d
	movl	$1, %ebp
	movl	$6, %edi
	movl	$7, %esi
	movl	$0, 4(%rsp)
	movl	$0, 8(%rsp)
	movl	$0, 12(%rsp)
	jmp	.L10
.L38:
	movl	$1, (%rsp)
	movl	%ecx, %eax
	xorl	%r11d, %r11d
	movl	$1, %r12d
	movl	$1, %ebp
	movl	$1, %ebx
	movl	$1, %edi
	movl	$1, 4(%rsp)
	movl	$1, 8(%rsp)
	movl	$2, %esi
	movl	$1, 12(%rsp)
	jmp	.L10
.L39:
	movl	$1, (%rsp)
	movl	$1, %r12d
	xorl	%edi, %edi
	movl	$1, %ebp
	movl	$1, %ebx
	movl	$1, %r11d
	movl	$1, %esi
	movl	$1, 4(%rsp)
	movl	$1, 8(%rsp)
	movl	$1, 12(%rsp)
	jmp	.L10
.L70:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC1:
	.long	4
	.long	5
	.long	6
	.long	7
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC2:
	.long	8
	.long	9
	.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 <math.h>
int main(void){
	int tab[10][400],a[10]={0,1,2,3,4,5,6,7,8,9},b[10]={0,0,0,0,0,0,0,0,0,0},sw[10]={1,1,1,1,1,1,1,1,1,1},sum,i,j,k,n,s;
	for(i=0;i<10;i++){for(j=0;j<400;j++){tab[i][j]=0;}}
	while(1){
		sum=0;
		for(i=0;i<10;i++){
			sum+=a[i]*(i+1);
			if(sw[i]==1){tab[i][sum]++;sw[i]=0;}
		}
		sw[9]=1;b[a[9]]=1;
		for(n=8;n>=0;n--){
			sw[n]=1;b[a[n]]=1;
			if(a[n]<a[n+1])break;
		}
		if(n<0)break;
		for(i=a[n]+1;i<10;i++){if(b[i]==1){a[n]=i;b[i]=0;break;}}
		for(i=0,n++;i<10&&n<10;i++){
			if(b[i]==1){a[n]=i;b[i]=0;n++;}
		}
	}
	while(scanf("%d %d",&n,&s)!=EOF){if(s>350)printf("0\n");else printf("%d\n",tab[n-1][s]);}
	return 0;
}
4 10
3 1
 6 10
3 1
 2 14
3 1
 2 25
10 0
 2 4
10 0
 3 10
0 1
 3 14
10 3
 3 10
2 1
 2 9
3 1
 2 14
2 1

1
0
 0
0
 5
0
 2
0
 3
0
 8
0
 14
0
 8
1
 4
0
 5
1

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 <math.h>
int main(void){
	int tab[10][400],a[10]={0,1,2,3,4,5,6,7,8,9},b[10]={0,0,0,0,0,0,0,0,0,0},sw[10]={1,1,1,1,1,1,1,1,1,1},sum,i,j,k,n,s;
	for(i=0;i<10;i++){for(j=0;j<400;j++){tab[i][j]=0;}}
	while(1){
		sum=0;
		for(i=0;i<10;i++){
			sum+=a[i]*(i+1);
			if(sw[i]==1){tab[i][sum]++;sw[i]=0;}
		}
		sw[9]=1;b[a[9]]=1;
		for(n=8;n>=0;n--){
			sw[n]=1;b[a[n]]=1;
			if(a[n]<a[n+1])break;
		}
		if(n<0)break;
		for(i=a[n]+1;i<10;i++){if(b[i]==1){a[n]=i;b[i]=0;break;}}
		for(i=0,n++;i<10&&n<10;i++){
			if(b[i]==1){a[n]=i;b[i]=0;n++;}
		}
	}
	while(scanf("%d %d",&n,&s)!=EOF){if(s>350)printf("0\n");else printf("%d\n",tab[n-1][s]);}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"0"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%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
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3904, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -16160(%rbp)
	movl	$1, -16156(%rbp)
	movl	$2, -16152(%rbp)
	movl	$3, -16148(%rbp)
	movl	$4, -16144(%rbp)
	movl	$5, -16140(%rbp)
	movl	$6, -16136(%rbp)
	movl	$7, -16132(%rbp)
	movl	$8, -16128(%rbp)
	movl	$9, -16124(%rbp)
	movq	$0, -16112(%rbp)
	movq	$0, -16104(%rbp)
	movq	$0, -16096(%rbp)
	movq	$0, -16088(%rbp)
	movq	$0, -16080(%rbp)
	movl	$1, -16064(%rbp)
	movl	$1, -16060(%rbp)
	movl	$1, -16056(%rbp)
	movl	$1, -16052(%rbp)
	movl	$1, -16048(%rbp)
	movl	$1, -16044(%rbp)
	movl	$1, -16040(%rbp)
	movl	$1, -16036(%rbp)
	movl	$1, -16032(%rbp)
	movl	$1, -16028(%rbp)
	movl	$0, -16168(%rbp)
	jmp	.L2
.L5:
	movl	$0, -16164(%rbp)
	jmp	.L3
.L4:
	movl	-16164(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16168(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	movl	$0, -16016(%rbp,%rax,4)
	addl	$1, -16164(%rbp)
.L3:
	cmpl	$399, -16164(%rbp)
	jle	.L4
	addl	$1, -16168(%rbp)
.L2:
	cmpl	$9, -16168(%rbp)
	jle	.L5
.L23:
	movl	$0, -16172(%rbp)
	movl	$0, -16168(%rbp)
	jmp	.L6
.L8:
	movl	-16168(%rbp), %eax
	cltq
	movl	-16160(%rbp,%rax,4), %eax
	movl	-16168(%rbp), %edx
	addl	$1, %edx
	imull	%edx, %eax
	addl	%eax, -16172(%rbp)
	movl	-16168(%rbp), %eax
	cltq
	movl	-16064(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L7
	movl	-16172(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16168(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	movl	-16016(%rbp,%rax,4), %eax
	leal	1(%rax), %ecx
	movl	-16172(%rbp), %eax
	movslq	%eax, %rsi
	movl	-16168(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rsi, %rax
	movl	%ecx, -16016(%rbp,%rax,4)
	movl	-16168(%rbp), %eax
	cltq
	movl	$0, -16064(%rbp,%rax,4)
.L7:
	addl	$1, -16168(%rbp)
.L6:
	cmpl	$9, -16168(%rbp)
	jle	.L8
	movl	$1, -16028(%rbp)
	movl	-16124(%rbp), %eax
	cltq
	movl	$1, -16112(%rbp,%rax,4)
	movl	$8, -16180(%rbp)
	jmp	.L9
.L12:
	movl	-16180(%rbp), %eax
	cltq
	movl	$1, -16064(%rbp,%rax,4)
	movl	-16180(%rbp), %eax
	cltq
	movl	-16160(%rbp,%rax,4), %eax
	cltq
	movl	$1, -16112(%rbp,%rax,4)
	movl	-16180(%rbp), %eax
	cltq
	movl	-16160(%rbp,%rax,4), %edx
	movl	-16180(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-16160(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jl	.L30
	movl	-16180(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -16180(%rbp)
.L9:
	movl	-16180(%rbp), %eax
	testl	%eax, %eax
	jns	.L12
	jmp	.L11
.L30:
	nop
.L11:
	movl	-16180(%rbp), %eax
	testl	%eax, %eax
	js	.L31
	movl	-16180(%rbp), %eax
	cltq
	movl	-16160(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, -16168(%rbp)
	jmp	.L15
.L18:
	movl	-16168(%rbp), %eax
	cltq
	movl	-16112(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-16180(%rbp), %eax
	cltq
	movl	-16168(%rbp), %edx
	movl	%edx, -16160(%rbp,%rax,4)
	movl	-16168(%rbp), %eax
	cltq
	movl	$0, -16112(%rbp,%rax,4)
	jmp	.L17
.L16:
	addl	$1, -16168(%rbp)
.L15:
	cmpl	$9, -16168(%rbp)
	jle	.L18
.L17:
	movl	$0, -16168(%rbp)
	movl	-16180(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16180(%rbp)
	jmp	.L19
.L22:
	movl	-16168(%rbp), %eax
	cltq
	movl	-16112(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L20
	movl	-16180(%rbp), %eax
	cltq
	movl	-16168(%rbp), %edx
	movl	%edx, -16160(%rbp,%rax,4)
	movl	-16168(%rbp), %eax
	cltq
	movl	$0, -16112(%rbp,%rax,4)
	movl	-16180(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16180(%rbp)
.L20:
	addl	$1, -16168(%rbp)
.L19:
	cmpl	$9, -16168(%rbp)
	jg	.L23
	movl	-16180(%rbp), %eax
	cmpl	$9, %eax
	jle	.L22
	jmp	.L23
.L31:
	nop
	jmp	.L24
.L26:
	movl	-16176(%rbp), %eax
	cmpl	$350, %eax
	jle	.L25
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L24
.L25:
	movl	-16180(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-16176(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	movl	-16016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L24:
	leaq	-16176(%rbp), %rdx
	leaq	-16180(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L26
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	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
	.section	.rodata
.LC0:
	.string	"0"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%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
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3904, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -16160(%rbp)
	movl	$1, -16156(%rbp)
	movl	$2, -16152(%rbp)
	movl	$3, -16148(%rbp)
	movl	$4, -16144(%rbp)
	movl	$5, -16140(%rbp)
	movl	$6, -16136(%rbp)
	movl	$7, -16132(%rbp)
	movl	$8, -16128(%rbp)
	movl	$9, -16124(%rbp)
	movq	$0, -16112(%rbp)
	movq	$0, -16104(%rbp)
	movq	$0, -16096(%rbp)
	movq	$0, -16088(%rbp)
	movq	$0, -16080(%rbp)
	movl	$1, -16064(%rbp)
	movl	$1, -16060(%rbp)
	movl	$1, -16056(%rbp)
	movl	$1, -16052(%rbp)
	movl	$1, -16048(%rbp)
	movl	$1, -16044(%rbp)
	movl	$1, -16040(%rbp)
	movl	$1, -16036(%rbp)
	movl	$1, -16032(%rbp)
	movl	$1, -16028(%rbp)
	movl	$0, -16168(%rbp)
	jmp	.L2
.L5:
	movl	$0, -16164(%rbp)
	jmp	.L3
.L4:
	movl	-16164(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16168(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	movl	$0, -16016(%rbp,%rax,4)
	addl	$1, -16164(%rbp)
.L3:
	cmpl	$399, -16164(%rbp)
	jle	.L4
	addl	$1, -16168(%rbp)
.L2:
	cmpl	$9, -16168(%rbp)
	jle	.L5
.L23:
	movl	$0, -16172(%rbp)
	movl	$0, -16168(%rbp)
	jmp	.L6
.L8:
	movl	-16168(%rbp), %eax
	cltq
	movl	-16160(%rbp,%rax,4), %eax
	movl	-16168(%rbp), %edx
	addl	$1, %edx
	imull	%edx, %eax
	addl	%eax, -16172(%rbp)
	movl	-16168(%rbp), %eax
	cltq
	movl	-16064(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L7
	movl	-16172(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16168(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	movl	-16016(%rbp,%rax,4), %eax
	leal	1(%rax), %ecx
	movl	-16172(%rbp), %eax
	movslq	%eax, %rsi
	movl	-16168(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rsi, %rax
	movl	%ecx, -16016(%rbp,%rax,4)
	movl	-16168(%rbp), %eax
	cltq
	movl	$0, -16064(%rbp,%rax,4)
.L7:
	addl	$1, -16168(%rbp)
.L6:
	cmpl	$9, -16168(%rbp)
	jle	.L8
	movl	$1, -16028(%rbp)
	movl	-16124(%rbp), %eax
	cltq
	movl	$1, -16112(%rbp,%rax,4)
	movl	$8, -16180(%rbp)
	jmp	.L9
.L12:
	movl	-16180(%rbp), %eax
	cltq
	movl	$1, -16064(%rbp,%rax,4)
	movl	-16180(%rbp), %eax
	cltq
	movl	-16160(%rbp,%rax,4), %eax
	cltq
	movl	$1, -16112(%rbp,%rax,4)
	movl	-16180(%rbp), %eax
	cltq
	movl	-16160(%rbp,%rax,4), %edx
	movl	-16180(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-16160(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jl	.L30
	movl	-16180(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -16180(%rbp)
.L9:
	movl	-16180(%rbp), %eax
	testl	%eax, %eax
	jns	.L12
	jmp	.L11
.L30:
	nop
.L11:
	movl	-16180(%rbp), %eax
	testl	%eax, %eax
	js	.L31
	movl	-16180(%rbp), %eax
	cltq
	movl	-16160(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, -16168(%rbp)
	jmp	.L15
.L18:
	movl	-16168(%rbp), %eax
	cltq
	movl	-16112(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-16180(%rbp), %eax
	cltq
	movl	-16168(%rbp), %edx
	movl	%edx, -16160(%rbp,%rax,4)
	movl	-16168(%rbp), %eax
	cltq
	movl	$0, -16112(%rbp,%rax,4)
	jmp	.L17
.L16:
	addl	$1, -16168(%rbp)
.L15:
	cmpl	$9, -16168(%rbp)
	jle	.L18
.L17:
	movl	$0, -16168(%rbp)
	movl	-16180(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16180(%rbp)
	jmp	.L19
.L22:
	movl	-16168(%rbp), %eax
	cltq
	movl	-16112(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L20
	movl	-16180(%rbp), %eax
	cltq
	movl	-16168(%rbp), %edx
	movl	%edx, -16160(%rbp,%rax,4)
	movl	-16168(%rbp), %eax
	cltq
	movl	$0, -16112(%rbp,%rax,4)
	movl	-16180(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16180(%rbp)
.L20:
	addl	$1, -16168(%rbp)
.L19:
	cmpl	$9, -16168(%rbp)
	jg	.L23
	movl	-16180(%rbp), %eax
	cmpl	$9, %eax
	jle	.L22
	jmp	.L23
.L31:
	nop
	jmp	.L24
.L26:
	movl	-16176(%rbp), %eax
	cmpl	$350, %eax
	jle	.L25
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L24
.L25:
	movl	-16180(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-16176(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	movl	-16016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L24:
	leaq	-16176(%rbp), %rdx
	leaq	-16180(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L26
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	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:
