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

```c
#include<stdio.h>
 
int N,idx;
char S[105];
 
int fact();
int expr();
int term();
int number();
 
int expr()
{
    int res=term();
    for(;S[idx]=='+'||S[idx]=='-';)
    {
        char op=S[idx++];
        int tmp=term();
        if(op=='+')res+=tmp;
        else res-=tmp;
    }
    return res;
}
 
int term()
{
    int res=fact();
    for(;S[idx]=='*'||S[idx]=='/';)
    {
        char op=S[idx++];
        int tmp=fact();
        if(op=='*')res*=tmp;
        else res/=tmp;
    }
    return res;
}
 
int fact()
{
    int res;
    if(S[idx]=='(')
    {
        idx++;
        res=expr();
        idx++;
    }
    else
        res=number();
    return res;
}
 
int number()
{
    int res=0;
    for(;'0'<=S[idx]&&S[idx]<='9';idx++)
    {
        res=res*10+S[idx]-'0';
    }
    return res;
}
 
 
int main()
{
    scanf("%d\n",&N);
    for(;N--;)
    {
        idx=0;
        gets(S);
        printf("%d\n",expr());
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	idx
	.align 4
	.type	idx, @object
	.size	idx, 4
idx:
	.zero	4
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 105
S:
	.zero	105
	.text
	.globl	expr
	.type	expr, @function
expr:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, %eax
	call	term
	movl	%eax, -8(%rbp)
	jmp	.L2
.L4:
	movl	idx(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, idx(%rip)
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, -9(%rbp)
	movl	$0, %eax
	call	term
	movl	%eax, -4(%rbp)
	cmpb	$43, -9(%rbp)
	jne	.L3
	movl	-4(%rbp), %eax
	addl	%eax, -8(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	subl	%eax, -8(%rbp)
.L2:
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$43, %al
	je	.L4
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$45, %al
	je	.L4
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	expr, .-expr
	.globl	term
	.type	term, @function
term:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, %eax
	call	fact
	movl	%eax, -8(%rbp)
	jmp	.L7
.L9:
	movl	idx(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, idx(%rip)
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, -9(%rbp)
	movl	$0, %eax
	call	fact
	movl	%eax, -4(%rbp)
	cmpb	$42, -9(%rbp)
	jne	.L8
	movl	-8(%rbp), %eax
	imull	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L7
.L8:
	movl	-8(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%eax, -8(%rbp)
.L7:
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$42, %al
	je	.L9
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$47, %al
	je	.L9
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	term, .-term
	.globl	fact
	.type	fact, @function
fact:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$40, %al
	jne	.L12
	movl	idx(%rip), %eax
	addl	$1, %eax
	movl	%eax, idx(%rip)
	movl	$0, %eax
	call	expr
	movl	%eax, -4(%rbp)
	movl	idx(%rip), %eax
	addl	$1, %eax
	movl	%eax, idx(%rip)
	jmp	.L13
.L12:
	movl	$0, %eax
	call	number
	movl	%eax, -4(%rbp)
.L13:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	fact, .-fact
	.globl	number
	.type	number, @function
number:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L16
.L18:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %ecx
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	addl	%ecx, %eax
	subl	$48, %eax
	movl	%eax, -4(%rbp)
	movl	idx(%rip), %eax
	addl	$1, %eax
	movl	%eax, idx(%rip)
.L16:
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$47, %al
	jle	.L17
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$57, %al
	jle	.L18
.L17:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	number, .-number
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L21
.L22:
	movl	$0, idx(%rip)
	leaq	S(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	movl	$0, %eax
	call	expr
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L21:
	movl	N(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, N(%rip)
	testl	%eax, %eax
	jne	.L22
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.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
	.p2align 4
	.globl	term
	.type	term, @function
term:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	idx(%rip), %rax
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rax, %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	S(%rip), %rbp
	movsbl	0(%rbp,%rax), %r12d
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	cmpb	$40, %r12b
	je	.L2
	leal	1(%rax), %eax
	leal	-48(%r12), %edx
	xorl	%r13d, %r13d
	cltq
	cmpb	$9, %dl
	ja	.L4
	.p2align 4,,10
	.p2align 3
.L11:
	leal	0(%r13,%r13,4), %edx
	movl	%eax, %esi
	leal	-48(%r12,%rdx,2), %r13d
	movsbl	0(%rbp,%rax), %r12d
	addq	$1, %rax
	leal	-48(%r12), %edx
	cmpb	$9, %dl
	jbe	.L11
	movl	%esi, idx(%rip)
.L4:
	cmpb	$47, %r12b
	je	.L31
	cmpb	$42, %r12b
	jne	.L1
	.p2align 4,,10
	.p2align 3
.L31:
	leal	1(%rsi), %edx
	movslq	%edx, %rax
	movl	%edx, idx(%rip)
	movsbl	0(%rbp,%rax), %ecx
	cmpb	$40, %cl
	je	.L12
	leal	2(%rsi), %eax
	leal	-48(%rcx), %edi
	xorl	%ebx, %ebx
	movl	%edx, %esi
	cltq
	cmpb	$9, %dil
	ja	.L14
	.p2align 4,,10
	.p2align 3
.L19:
	leal	(%rbx,%rbx,4), %edx
	movl	%eax, %esi
	leal	-48(%rcx,%rdx,2), %ebx
	movsbl	0(%rbp,%rax), %ecx
	addq	$1, %rax
	leal	-48(%rcx), %edx
	cmpb	$9, %dl
	jbe	.L19
	movl	%esi, idx(%rip)
.L14:
	cmpb	$42, %r12b
	je	.L36
	movl	%r13d, %eax
	cltd
	idivl	%ebx
	movl	%eax, %r13d
.L21:
	cmpb	$42, %cl
	je	.L22
	cmpb	$47, %cl
	jne	.L1
.L22:
	movl	%ecx, %r12d
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L1:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r13d, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L36:
	.cfi_restore_state
	imull	%ebx, %r13d
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L12:
	addl	$2, %esi
	xorl	%eax, %eax
	movl	%esi, idx(%rip)
	call	term
	movl	%eax, %ebx
.L34:
	movslq	idx(%rip), %rax
	movzbl	0(%rbp,%rax), %r14d
	movq	%rax, %rsi
	addl	$1, %esi
	leal	-43(%r14), %eax
	movl	%esi, idx(%rip)
	testb	$-3, %al
	jne	.L15
	xorl	%eax, %eax
	call	term
	leal	(%rbx,%rax), %edx
	subl	%eax, %ebx
	cmpb	$43, %r14b
	cmove	%edx, %ebx
	jmp	.L34
.L15:
	movslq	%esi, %rax
	movzbl	0(%rbp,%rax), %ecx
	jmp	.L14
.L2:
	addl	$1, %esi
	xorl	%eax, %eax
	movl	%esi, idx(%rip)
	call	term
	movl	%eax, %r13d
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L37:
	xorl	%eax, %eax
	call	term
	leal	0(%r13,%rax), %edx
	subl	%eax, %r13d
	cmpb	$43, %bl
	cmove	%edx, %r13d
.L33:
	movslq	idx(%rip), %rax
	movzbl	0(%rbp,%rax), %ebx
	movq	%rax, %rsi
	addl	$1, %esi
	leal	-43(%rbx), %eax
	movl	%esi, idx(%rip)
	testb	$-3, %al
	je	.L37
	movslq	%esi, %rax
	movzbl	0(%rbp,%rax), %r12d
	jmp	.L4
	.cfi_endproc
.LFE24:
	.size	term, .-term
	.p2align 4
	.globl	expr
	.type	expr, @function
expr:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	leaq	S(%rip), %r10
	call	term
	movslq	idx(%rip), %rdx
	movl	%eax, %r8d
	movzbl	(%r10,%rdx), %r9d
	movq	%rdx, %rax
	leal	-43(%r9), %edx
	andl	$253, %edx
	jne	.L38
	.p2align 4,,10
	.p2align 3
.L42:
	addl	$1, %eax
	movl	%eax, idx(%rip)
	xorl	%eax, %eax
	call	term
	leal	(%r8,%rax), %edx
	subl	%eax, %r8d
	cmpb	$43, %r9b
	cmove	%edx, %r8d
	movslq	idx(%rip), %rdx
	movzbl	(%r10,%rdx), %r9d
	movq	%rdx, %rax
	leal	-43(%r9), %edx
	andl	$253, %edx
	je	.L42
.L38:
	movl	%r8d, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE23:
	.size	expr, .-expr
	.p2align 4
	.globl	fact
	.type	fact, @function
fact:
.LFB25:
	.cfi_startproc
	endbr64
	movslq	idx(%rip), %rax
	leaq	S(%rip), %r9
	movq	%rax, %rdx
	movsbl	(%r9,%rax), %eax
	cmpb	$40, %al
	je	.L47
	addl	$1, %edx
	leal	-48(%rax), %ecx
	xorl	%r8d, %r8d
	movslq	%edx, %rdx
	cmpb	$9, %cl
	ja	.L60
	.p2align 4,,10
	.p2align 3
.L54:
	leal	(%r8,%r8,4), %ecx
	movl	%edx, %esi
	leal	-48(%rax,%rcx,2), %r8d
	movsbl	(%r9,%rdx), %eax
	addq	$1, %rdx
	leal	-48(%rax), %ecx
	cmpb	$9, %cl
	jbe	.L54
	movl	%esi, idx(%rip)
.L60:
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L47:
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	addl	$1, %edx
	xorl	%eax, %eax
	movl	%edx, idx(%rip)
	call	term
	movl	%eax, %r8d
	jmp	.L62
	.p2align 4,,10
	.p2align 3
.L63:
	xorl	%eax, %eax
	call	term
	leal	(%r8,%rax), %edx
	subl	%eax, %r8d
	cmpb	$43, %r10b
	cmove	%edx, %r8d
.L62:
	movslq	idx(%rip), %rdx
	movzbl	(%r9,%rdx), %r10d
	movq	%rdx, %rax
	addl	$1, %eax
	leal	-43(%r10), %edx
	movl	%eax, idx(%rip)
	andl	$253, %edx
	je	.L63
	movl	%r8d, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE25:
	.size	fact, .-fact
	.p2align 4
	.globl	number
	.type	number, @function
number:
.LFB26:
	.cfi_startproc
	endbr64
	movslq	idx(%rip), %rax
	leaq	S(%rip), %rsi
	movq	%rax, %rdx
	movsbl	(%rsi,%rax), %eax
	leal	-48(%rax), %ecx
	cmpb	$9, %cl
	ja	.L67
	addl	$1, %edx
	xorl	%r8d, %r8d
	movslq	%edx, %rdx
	.p2align 4,,10
	.p2align 3
.L66:
	leal	(%r8,%r8,4), %ecx
	movl	%edx, %edi
	leal	-48(%rax,%rcx,2), %r8d
	movsbl	(%rsi,%rdx), %eax
	addq	$1, %rdx
	leal	-48(%rax), %ecx
	cmpb	$9, %cl
	jbe	.L66
	movl	%edi, idx(%rip)
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L67:
	xorl	%r8d, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE26:
	.size	number, .-number
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB27:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, N(%rip)
	testl	%eax, %eax
	je	.L98
	leaq	S(%rip), %r12
.L70:
	movl	$0, idx(%rip)
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	gets@PLT
	xorl	%eax, %eax
	call	term
	movl	%eax, %r11d
	movslq	idx(%rip), %rax
	movzbl	(%r12,%rax), %ebp
	movq	%rax, %rdi
	leal	-43(%rbp), %eax
	testb	$-3, %al
	jne	.L71
	.p2align 4,,10
	.p2align 3
.L86:
	leal	1(%rdi), %edx
	movslq	%edx, %rax
	movl	%edx, idx(%rip)
	movsbl	(%r12,%rax), %r13d
	cmpb	$40, %r13b
	je	.L72
	leal	2(%rdi), %eax
	leal	-48(%r13), %ecx
	xorl	%r14d, %r14d
	movl	%edx, %edi
	cltq
	cmpb	$9, %cl
	ja	.L74
	.p2align 4,,10
	.p2align 3
.L77:
	leal	(%r14,%r14,4), %edx
	movl	%eax, %edi
	leal	-48(%r13,%rdx,2), %r14d
	movsbl	(%r12,%rax), %r13d
	addq	$1, %rax
	leal	-48(%r13), %edx
	cmpb	$9, %dl
	jbe	.L77
	movl	%edi, idx(%rip)
.L74:
	cmpb	$42, %r13b
	je	.L97
	movl	%r13d, %ecx
	cmpb	$47, %r13b
	jne	.L76
	.p2align 4,,10
	.p2align 3
.L97:
	leal	1(%rdi), %edx
	movslq	%edx, %rax
	movl	%edx, idx(%rip)
	movsbl	(%r12,%rax), %ecx
	cmpb	$40, %cl
	je	.L78
	leal	2(%rdi), %eax
	leal	-48(%rcx), %r8d
	xorl	%esi, %esi
	movl	%edx, %edi
	cltq
	cmpb	$9, %r8b
	ja	.L80
	.p2align 4,,10
	.p2align 3
.L81:
	leal	(%rsi,%rsi,4), %edx
	movl	%eax, %edi
	leal	-48(%rcx,%rdx,2), %esi
	movsbl	(%r12,%rax), %ecx
	addq	$1, %rax
	leal	-48(%rcx), %edx
	cmpb	$9, %dl
	jbe	.L81
	movl	%edi, idx(%rip)
.L80:
	cmpb	$42, %r13b
	je	.L100
	movl	%r14d, %eax
	cltd
	idivl	%esi
	movl	%eax, %r14d
.L83:
	cmpb	$42, %cl
	je	.L88
	cmpb	$47, %cl
	jne	.L76
.L88:
	movl	%ecx, %r13d
	jmp	.L97
	.p2align 4,,10
	.p2align 3
.L100:
	imull	%esi, %r14d
	jmp	.L83
	.p2align 4,,10
	.p2align 3
.L78:
	addl	$2, %edi
	xorl	%eax, %eax
	movl	%edi, idx(%rip)
	call	expr
	movl	%eax, %esi
	movl	idx(%rip), %eax
	leal	1(%rax), %edi
	movslq	%edi, %rax
	movl	%edi, idx(%rip)
	movzbl	(%r12,%rax), %ecx
	jmp	.L80
	.p2align 4,,10
	.p2align 3
.L76:
	leal	(%r11,%r14), %eax
	subl	%r14d, %r11d
	cmpb	$43, %bpl
	cmove	%eax, %r11d
	leal	-43(%rcx), %eax
	testb	$-3, %al
	jne	.L71
	movl	%ecx, %ebp
	jmp	.L86
.L72:
	addl	$2, %edi
	xorl	%eax, %eax
	movl	%edi, idx(%rip)
	call	expr
	movl	%eax, %r14d
	movl	idx(%rip), %eax
	leal	1(%rax), %edi
	movslq	%edi, %rax
	movl	%edi, idx(%rip)
	movzbl	(%r12,%rax), %r13d
	jmp	.L74
.L71:
	movl	%r11d, %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	N(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, N(%rip)
	testl	%eax, %eax
	jne	.L70
.L98:
	popq	%rbx
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE27:
	.size	main, .-main
	.globl	S
	.bss
	.align 32
	.type	S, @object
	.size	S, 105
S:
	.zero	105
	.globl	idx
	.align 4
	.type	idx, @object
	.size	idx, 4
idx:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	term
	.type	term, @function
term:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	idx(%rip), %rax
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rax, %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	S(%rip), %rbp
	movsbl	0(%rbp,%rax), %r12d
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	cmpb	$40, %r12b
	je	.L2
	leal	1(%rax), %eax
	leal	-48(%r12), %edx
	xorl	%r13d, %r13d
	cltq
	cmpb	$9, %dl
	ja	.L4
	.p2align 4,,10
	.p2align 3
.L11:
	leal	0(%r13,%r13,4), %edx
	movl	%eax, %esi
	leal	-48(%r12,%rdx,2), %r13d
	movsbl	0(%rbp,%rax), %r12d
	addq	$1, %rax
	leal	-48(%r12), %edx
	cmpb	$9, %dl
	jbe	.L11
	movl	%esi, idx(%rip)
.L4:
	cmpb	$47, %r12b
	je	.L31
	cmpb	$42, %r12b
	jne	.L1
	.p2align 4,,10
	.p2align 3
.L31:
	leal	1(%rsi), %edx
	movslq	%edx, %rax
	movl	%edx, idx(%rip)
	movsbl	0(%rbp,%rax), %ecx
	cmpb	$40, %cl
	je	.L12
	leal	2(%rsi), %eax
	leal	-48(%rcx), %edi
	xorl	%ebx, %ebx
	movl	%edx, %esi
	cltq
	cmpb	$9, %dil
	ja	.L14
	.p2align 4,,10
	.p2align 3
.L19:
	leal	(%rbx,%rbx,4), %edx
	movl	%eax, %esi
	leal	-48(%rcx,%rdx,2), %ebx
	movsbl	0(%rbp,%rax), %ecx
	addq	$1, %rax
	leal	-48(%rcx), %edx
	cmpb	$9, %dl
	jbe	.L19
	movl	%esi, idx(%rip)
.L14:
	cmpb	$42, %r12b
	je	.L36
	movl	%r13d, %eax
	cltd
	idivl	%ebx
	movl	%eax, %r13d
.L21:
	cmpb	$42, %cl
	je	.L22
	cmpb	$47, %cl
	jne	.L1
.L22:
	movl	%ecx, %r12d
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L1:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r13d, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L36:
	.cfi_restore_state
	imull	%ebx, %r13d
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L12:
	addl	$2, %esi
	xorl	%eax, %eax
	movl	%esi, idx(%rip)
	call	term
	movl	%eax, %ebx
.L34:
	movslq	idx(%rip), %rax
	movzbl	0(%rbp,%rax), %r14d
	movq	%rax, %rsi
	addl	$1, %esi
	leal	-43(%r14), %eax
	movl	%esi, idx(%rip)
	testb	$-3, %al
	jne	.L15
	xorl	%eax, %eax
	call	term
	leal	(%rbx,%rax), %edx
	subl	%eax, %ebx
	cmpb	$43, %r14b
	cmove	%edx, %ebx
	jmp	.L34
.L15:
	movslq	%esi, %rax
	movzbl	0(%rbp,%rax), %ecx
	jmp	.L14
.L2:
	addl	$1, %esi
	xorl	%eax, %eax
	movl	%esi, idx(%rip)
	call	term
	movl	%eax, %r13d
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L37:
	xorl	%eax, %eax
	call	term
	leal	0(%r13,%rax), %edx
	subl	%eax, %r13d
	cmpb	$43, %bl
	cmove	%edx, %r13d
.L33:
	movslq	idx(%rip), %rax
	movzbl	0(%rbp,%rax), %ebx
	movq	%rax, %rsi
	addl	$1, %esi
	leal	-43(%rbx), %eax
	movl	%esi, idx(%rip)
	testb	$-3, %al
	je	.L37
	movslq	%esi, %rax
	movzbl	0(%rbp,%rax), %r12d
	jmp	.L4
	.cfi_endproc
.LFE24:
	.size	term, .-term
	.p2align 4
	.globl	expr
	.type	expr, @function
expr:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	leaq	S(%rip), %r10
	call	term
	movslq	idx(%rip), %rdx
	movl	%eax, %r8d
	movzbl	(%r10,%rdx), %r9d
	movq	%rdx, %rax
	leal	-43(%r9), %edx
	andl	$253, %edx
	jne	.L38
	.p2align 4,,10
	.p2align 3
.L42:
	addl	$1, %eax
	movl	%eax, idx(%rip)
	xorl	%eax, %eax
	call	term
	leal	(%r8,%rax), %edx
	subl	%eax, %r8d
	cmpb	$43, %r9b
	cmove	%edx, %r8d
	movslq	idx(%rip), %rdx
	movzbl	(%r10,%rdx), %r9d
	movq	%rdx, %rax
	leal	-43(%r9), %edx
	andl	$253, %edx
	je	.L42
.L38:
	movl	%r8d, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE23:
	.size	expr, .-expr
	.p2align 4
	.globl	fact
	.type	fact, @function
fact:
.LFB25:
	.cfi_startproc
	endbr64
	movslq	idx(%rip), %rax
	leaq	S(%rip), %r9
	movq	%rax, %rdx
	movsbl	(%r9,%rax), %eax
	cmpb	$40, %al
	je	.L47
	addl	$1, %edx
	leal	-48(%rax), %ecx
	xorl	%r8d, %r8d
	movslq	%edx, %rdx
	cmpb	$9, %cl
	ja	.L60
	.p2align 4,,10
	.p2align 3
.L54:
	leal	(%r8,%r8,4), %ecx
	movl	%edx, %esi
	leal	-48(%rax,%rcx,2), %r8d
	movsbl	(%r9,%rdx), %eax
	addq	$1, %rdx
	leal	-48(%rax), %ecx
	cmpb	$9, %cl
	jbe	.L54
	movl	%esi, idx(%rip)
.L60:
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L47:
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	addl	$1, %edx
	xorl	%eax, %eax
	movl	%edx, idx(%rip)
	call	term
	movl	%eax, %r8d
	jmp	.L62
	.p2align 4,,10
	.p2align 3
.L63:
	xorl	%eax, %eax
	call	term
	leal	(%r8,%rax), %edx
	subl	%eax, %r8d
	cmpb	$43, %r10b
	cmove	%edx, %r8d
.L62:
	movslq	idx(%rip), %rdx
	movzbl	(%r9,%rdx), %r10d
	movq	%rdx, %rax
	addl	$1, %eax
	leal	-43(%r10), %edx
	movl	%eax, idx(%rip)
	andl	$253, %edx
	je	.L63
	movl	%r8d, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE25:
	.size	fact, .-fact
	.p2align 4
	.globl	number
	.type	number, @function
number:
.LFB26:
	.cfi_startproc
	endbr64
	movslq	idx(%rip), %rax
	leaq	S(%rip), %rsi
	movq	%rax, %rdx
	movsbl	(%rsi,%rax), %eax
	leal	-48(%rax), %ecx
	cmpb	$9, %cl
	ja	.L67
	addl	$1, %edx
	xorl	%r8d, %r8d
	movslq	%edx, %rdx
	.p2align 4,,10
	.p2align 3
.L66:
	leal	(%r8,%r8,4), %ecx
	movl	%edx, %edi
	leal	-48(%rax,%rcx,2), %r8d
	movsbl	(%rsi,%rdx), %eax
	addq	$1, %rdx
	leal	-48(%rax), %ecx
	cmpb	$9, %cl
	jbe	.L66
	movl	%edi, idx(%rip)
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L67:
	xorl	%r8d, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE26:
	.size	number, .-number
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB27:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, N(%rip)
	testl	%eax, %eax
	je	.L98
	leaq	S(%rip), %r12
.L70:
	movl	$0, idx(%rip)
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	gets@PLT
	xorl	%eax, %eax
	call	term
	movl	%eax, %r11d
	movslq	idx(%rip), %rax
	movzbl	(%r12,%rax), %ebp
	movq	%rax, %rdi
	leal	-43(%rbp), %eax
	testb	$-3, %al
	jne	.L71
	.p2align 4,,10
	.p2align 3
.L86:
	leal	1(%rdi), %edx
	movslq	%edx, %rax
	movl	%edx, idx(%rip)
	movsbl	(%r12,%rax), %r13d
	cmpb	$40, %r13b
	je	.L72
	leal	2(%rdi), %eax
	leal	-48(%r13), %ecx
	xorl	%r14d, %r14d
	movl	%edx, %edi
	cltq
	cmpb	$9, %cl
	ja	.L74
	.p2align 4,,10
	.p2align 3
.L77:
	leal	(%r14,%r14,4), %edx
	movl	%eax, %edi
	leal	-48(%r13,%rdx,2), %r14d
	movsbl	(%r12,%rax), %r13d
	addq	$1, %rax
	leal	-48(%r13), %edx
	cmpb	$9, %dl
	jbe	.L77
	movl	%edi, idx(%rip)
.L74:
	cmpb	$42, %r13b
	je	.L97
	movl	%r13d, %ecx
	cmpb	$47, %r13b
	jne	.L76
	.p2align 4,,10
	.p2align 3
.L97:
	leal	1(%rdi), %edx
	movslq	%edx, %rax
	movl	%edx, idx(%rip)
	movsbl	(%r12,%rax), %ecx
	cmpb	$40, %cl
	je	.L78
	leal	2(%rdi), %eax
	leal	-48(%rcx), %r8d
	xorl	%esi, %esi
	movl	%edx, %edi
	cltq
	cmpb	$9, %r8b
	ja	.L80
	.p2align 4,,10
	.p2align 3
.L81:
	leal	(%rsi,%rsi,4), %edx
	movl	%eax, %edi
	leal	-48(%rcx,%rdx,2), %esi
	movsbl	(%r12,%rax), %ecx
	addq	$1, %rax
	leal	-48(%rcx), %edx
	cmpb	$9, %dl
	jbe	.L81
	movl	%edi, idx(%rip)
.L80:
	cmpb	$42, %r13b
	je	.L100
	movl	%r14d, %eax
	cltd
	idivl	%esi
	movl	%eax, %r14d
.L83:
	cmpb	$42, %cl
	je	.L88
	cmpb	$47, %cl
	jne	.L76
.L88:
	movl	%ecx, %r13d
	jmp	.L97
	.p2align 4,,10
	.p2align 3
.L100:
	imull	%esi, %r14d
	jmp	.L83
	.p2align 4,,10
	.p2align 3
.L78:
	addl	$2, %edi
	xorl	%eax, %eax
	movl	%edi, idx(%rip)
	call	expr
	movl	%eax, %esi
	movl	idx(%rip), %eax
	leal	1(%rax), %edi
	movslq	%edi, %rax
	movl	%edi, idx(%rip)
	movzbl	(%r12,%rax), %ecx
	jmp	.L80
	.p2align 4,,10
	.p2align 3
.L76:
	leal	(%r11,%r14), %eax
	subl	%r14d, %r11d
	cmpb	$43, %bpl
	cmove	%eax, %r11d
	leal	-43(%rcx), %eax
	testb	$-3, %al
	jne	.L71
	movl	%ecx, %ebp
	jmp	.L86
.L72:
	addl	$2, %edi
	xorl	%eax, %eax
	movl	%edi, idx(%rip)
	call	expr
	movl	%eax, %r14d
	movl	idx(%rip), %eax
	leal	1(%rax), %edi
	movslq	%edi, %rax
	movl	%edi, idx(%rip)
	movzbl	(%r12,%rax), %r13d
	jmp	.L74
.L71:
	movl	%r11d, %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	N(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, N(%rip)
	testl	%eax, %eax
	jne	.L70
.L98:
	popq	%rbx
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE27:
	.size	main, .-main
	.globl	S
	.bss
	.align 32
	.type	S, @object
	.size	S, 105
S:
	.zero	105
	.globl	idx
	.align 4
	.type	idx, @object
	.size	idx, 4
idx:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include<stdio.h>
 
int N,idx;
char S[105];
 
int fact();
int expr();
int term();
int number();
 
int expr()
{
    int res=term();
    for(;S[idx]=='+'||S[idx]=='-';)
    {
        char op=S[idx++];
        int tmp=term();
        if(op=='+')res+=tmp;
        else res-=tmp;
    }
    return res;
}
 
int term()
{
    int res=fact();
    for(;S[idx]=='*'||S[idx]=='/';)
    {
        char op=S[idx++];
        int tmp=fact();
        if(op=='*')res*=tmp;
        else res/=tmp;
    }
    return res;
}
 
int fact()
{
    int res;
    if(S[idx]=='(')
    {
        idx++;
        res=expr();
        idx++;
    }
    else
        res=number();
    return res;
}
 
int number()
{
    int res=0;
    for(;'0'<=S[idx]&&S[idx]<='9';idx++)
    {
        res=res*10+S[idx]-'0';
    }
    return res;
}
 
 
int main()
{
    scanf("%d\n",&N);
    for(;N--;)
    {
        idx=0;
        gets(S);
        printf("%d\n",expr());
    }
    return 0;
}
2
4-2*3=
8*(4+4+3)=
 2
4-2*3=
8*(4+4+2)=
 2
4-3*3=
4*(8+4+3)=
 2
4-1*3=
4*(8+4+3)=
 2
4-1+3=
4*(8+4+3)=
 2
4-2+3=
4*(8+4+3)=
 2
5-1+3=
4*(8+4+3)=
 2
3-1*3=
4*(8+4+3)=
 2
4-2+3=
4+(8+4*3)=
 2
4-2*3=
4+(8+4*3)=

-2
88
 -2
80
 -5
60
 1
60
 6
60
 5
60
 7
60
 0
60
 5
24
 -2
24

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

```c
#include<stdio.h>
 
int N,idx;
char S[105];
 
int fact();
int expr();
int term();
int number();
 
int expr()
{
    int res=term();
    for(;S[idx]=='+'||S[idx]=='-';)
    {
        char op=S[idx++];
        int tmp=term();
        if(op=='+')res+=tmp;
        else res-=tmp;
    }
    return res;
}
 
int term()
{
    int res=fact();
    for(;S[idx]=='*'||S[idx]=='/';)
    {
        char op=S[idx++];
        int tmp=fact();
        if(op=='*')res*=tmp;
        else res/=tmp;
    }
    return res;
}
 
int fact()
{
    int res;
    if(S[idx]=='(')
    {
        idx++;
        res=expr();
        idx++;
    }
    else
        res=number();
    return res;
}
 
int number()
{
    int res=0;
    for(;'0'<=S[idx]&&S[idx]<='9';idx++)
    {
        res=res*10+S[idx]-'0';
    }
    return res;
}
 
 
int main()
{
    scanf("%d\n",&N);
    for(;N--;)
    {
        idx=0;
        gets(S);
        printf("%d\n",expr());
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	idx
	.align 4
	.type	idx, @object
	.size	idx, 4
idx:
	.zero	4
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 105
S:
	.zero	105
	.text
	.globl	expr
	.type	expr, @function
expr:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, %eax
	call	term
	movl	%eax, -8(%rbp)
	jmp	.L2
.L4:
	movl	idx(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, idx(%rip)
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, -9(%rbp)
	movl	$0, %eax
	call	term
	movl	%eax, -4(%rbp)
	cmpb	$43, -9(%rbp)
	jne	.L3
	movl	-4(%rbp), %eax
	addl	%eax, -8(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	subl	%eax, -8(%rbp)
.L2:
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$43, %al
	je	.L4
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$45, %al
	je	.L4
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	expr, .-expr
	.globl	term
	.type	term, @function
term:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, %eax
	call	fact
	movl	%eax, -8(%rbp)
	jmp	.L7
.L9:
	movl	idx(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, idx(%rip)
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, -9(%rbp)
	movl	$0, %eax
	call	fact
	movl	%eax, -4(%rbp)
	cmpb	$42, -9(%rbp)
	jne	.L8
	movl	-8(%rbp), %eax
	imull	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L7
.L8:
	movl	-8(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%eax, -8(%rbp)
.L7:
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$42, %al
	je	.L9
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$47, %al
	je	.L9
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	term, .-term
	.globl	fact
	.type	fact, @function
fact:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$40, %al
	jne	.L12
	movl	idx(%rip), %eax
	addl	$1, %eax
	movl	%eax, idx(%rip)
	movl	$0, %eax
	call	expr
	movl	%eax, -4(%rbp)
	movl	idx(%rip), %eax
	addl	$1, %eax
	movl	%eax, idx(%rip)
	jmp	.L13
.L12:
	movl	$0, %eax
	call	number
	movl	%eax, -4(%rbp)
.L13:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	fact, .-fact
	.globl	number
	.type	number, @function
number:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L16
.L18:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %ecx
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	addl	%ecx, %eax
	subl	$48, %eax
	movl	%eax, -4(%rbp)
	movl	idx(%rip), %eax
	addl	$1, %eax
	movl	%eax, idx(%rip)
.L16:
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$47, %al
	jle	.L17
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$57, %al
	jle	.L18
.L17:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	number, .-number
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L21
.L22:
	movl	$0, idx(%rip)
	leaq	S(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	movl	$0, %eax
	call	expr
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L21:
	movl	N(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, N(%rip)
	testl	%eax, %eax
	jne	.L22
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	idx
	.align 4
	.type	idx, @object
	.size	idx, 4
idx:
	.zero	4
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 105
S:
	.zero	105
	.text
	.globl	expr
	.type	expr, @function
expr:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, %eax
	call	term
	movl	%eax, -8(%rbp)
	jmp	.L2
.L4:
	movl	idx(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, idx(%rip)
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, -9(%rbp)
	movl	$0, %eax
	call	term
	movl	%eax, -4(%rbp)
	cmpb	$43, -9(%rbp)
	jne	.L3
	movl	-4(%rbp), %eax
	addl	%eax, -8(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	subl	%eax, -8(%rbp)
.L2:
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$43, %al
	je	.L4
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$45, %al
	je	.L4
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	expr, .-expr
	.globl	term
	.type	term, @function
term:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, %eax
	call	fact
	movl	%eax, -8(%rbp)
	jmp	.L7
.L9:
	movl	idx(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, idx(%rip)
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, -9(%rbp)
	movl	$0, %eax
	call	fact
	movl	%eax, -4(%rbp)
	cmpb	$42, -9(%rbp)
	jne	.L8
	movl	-8(%rbp), %eax
	imull	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L7
.L8:
	movl	-8(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%eax, -8(%rbp)
.L7:
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$42, %al
	je	.L9
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$47, %al
	je	.L9
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	term, .-term
	.globl	fact
	.type	fact, @function
fact:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$40, %al
	jne	.L12
	movl	idx(%rip), %eax
	addl	$1, %eax
	movl	%eax, idx(%rip)
	movl	$0, %eax
	call	expr
	movl	%eax, -4(%rbp)
	movl	idx(%rip), %eax
	addl	$1, %eax
	movl	%eax, idx(%rip)
	jmp	.L13
.L12:
	movl	$0, %eax
	call	number
	movl	%eax, -4(%rbp)
.L13:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	fact, .-fact
	.globl	number
	.type	number, @function
number:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L16
.L18:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %ecx
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	addl	%ecx, %eax
	subl	$48, %eax
	movl	%eax, -4(%rbp)
	movl	idx(%rip), %eax
	addl	$1, %eax
	movl	%eax, idx(%rip)
.L16:
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$47, %al
	jle	.L17
	movl	idx(%rip), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$57, %al
	jle	.L18
.L17:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	number, .-number
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L21
.L22:
	movl	$0, idx(%rip)
	leaq	S(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	movl	$0, %eax
	call	expr
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L21:
	movl	N(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, N(%rip)
	testl	%eax, %eax
	jne	.L22
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.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:
