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

```c
// AOJ Volume 1 Problem 0109

#include <stdio.h>
#include <string.h>

int expression(char **form);
int term(char **form);
int factor(char **form);

int main(void)
{
	char formula[101];
	int n;
	int i;
	char *p;
	int result;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%s", formula);

		p = formula;
		result = expression(&p);
		printf("%d\n", result);
	}
	
	return (0);
}

int expression(char **form)
{
	int result;

	result = term(form);
	
	while (1){
		if (**form == '+'){
			(*form)++;
			result += term(form);
		}
		else if (**form == '-'){
			(*form)++;
			result -= term(form);
		}
		else if (**form == '='){
			(*form)++;
			break;
		}
		else {
			break;
		}
	}

	return (result);
}

int term(char **form)
{
	int result;
	

	result = factor(form);
	
	while (1){
		if (**form == '*'){
			(*form)++;
			result *= factor(form);
		}
		else if (**form == '/'){
			(*form)++;
			result /= factor(form);
		}
		else {
			break;
		}
	}
	return (result);
}

int factor(char **form)
{
	int result;
	
	if (**form == '('){
		(*form)++;
		result = expression(form);
		(*form)++;		// skip ')'
	}
	else {
		result = 0;
		while ('0' <= **form && **form <= '9'){
			result = result * 10 + **form - '0';
			(*form)++;
		}
	}
	
	return (result);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.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	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-132(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -128(%rbp)
	jmp	.L2
.L3:
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-112(%rbp), %rax
	movq	%rax, -120(%rbp)
	leaq	-120(%rbp), %rax
	movq	%rax, %rdi
	call	expression
	movl	%eax, -124(%rbp)
	movl	-124(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -128(%rbp)
.L2:
	movl	-132(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L3
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	expression
	.type	expression, @function
expression:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	term
	movl	%eax, -4(%rbp)
.L12:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$43, %al
	jne	.L7
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	term
	addl	%eax, -4(%rbp)
	jmp	.L12
.L7:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$45, %al
	jne	.L9
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	term
	subl	%eax, -4(%rbp)
	jmp	.L12
.L9:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$61, %al
	jne	.L14
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	jmp	.L11
.L14:
	nop
.L11:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	expression, .-expression
	.globl	term
	.type	term, @function
term:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	factor
	movl	%eax, -4(%rbp)
.L20:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$42, %al
	jne	.L16
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	factor
	movl	-4(%rbp), %edx
	imull	%edx, %eax
	movl	%eax, -4(%rbp)
	jmp	.L20
.L16:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jne	.L22
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	factor
	movl	%eax, %ecx
	movl	-4(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, -4(%rbp)
	jmp	.L20
.L22:
	nop
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	term, .-term
	.globl	factor
	.type	factor, @function
factor:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$40, %al
	jne	.L24
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	expression
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	jmp	.L25
.L24:
	movl	$0, -4(%rbp)
	jmp	.L26
.L27:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
.L26:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jle	.L25
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$57, %al
	jle	.L27
.L25:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	factor, .-factor
	.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	.text.unlikely,"ax",@progbits
.LCOLDB0:
	.text
.LHOTB0:
	.p2align 4
	.globl	term
	.type	term, @function
term:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	(%rdi), %rdx
	movsbl	(%rdx), %ecx
	cmpb	$40, %cl
	je	.L2
	leal	-48(%rcx), %eax
	xorl	%r12d, %r12d
	cmpb	$9, %al
	ja	.L10
	.p2align 4,,10
	.p2align 3
.L3:
	leal	(%r12,%r12,4), %eax
	addq	$1, %rdx
	leal	-48(%rcx,%rax,2), %r12d
	movq	%rdx, 0(%rbp)
	movsbl	(%rdx), %ecx
	leal	-48(%rcx), %eax
	cmpb	$9, %al
	jbe	.L3
.L10:
	cmpb	$42, %cl
	je	.L48
.L11:
	cmpb	$47, %cl
	jne	.L1
	leaq	1(%rdx), %rsi
	movq	%rsi, 0(%rbp)
	movsbl	1(%rdx), %ecx
	cmpb	$40, %cl
	je	.L22
	leal	-48(%rcx), %eax
	cmpb	$9, %al
	ja	.L49
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L23:
	leal	(%rbx,%rbx,4), %eax
	addq	$1, %rsi
	leal	-48(%rcx,%rax,2), %ebx
	movq	%rsi, 0(%rbp)
	movsbl	(%rsi), %ecx
	leal	-48(%rcx), %eax
	cmpb	$9, %al
	jbe	.L23
	movl	%r12d, %eax
	cltd
	idivl	%ebx
	movq	%rsi, %rdx
	movl	%eax, %r12d
.L52:
	cmpb	$42, %cl
	jne	.L11
.L48:
	leaq	1(%rdx), %rax
	movq	%rax, 0(%rbp)
	movsbl	1(%rdx), %ecx
	cmpb	$40, %cl
	je	.L12
	leal	-48(%rcx), %esi
	xorl	%edx, %edx
	cmpb	$9, %sil
	ja	.L50
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$1, %rax
	leal	(%rdx,%rdx,4), %edx
	movq	%rax, 0(%rbp)
	leal	-48(%rcx,%rdx,2), %edx
	movsbl	(%rax), %ecx
	leal	-48(%rcx), %esi
	cmpb	$9, %sil
	jbe	.L13
	imull	%edx, %r12d
	movq	%rax, %rdx
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L1:
	movl	%r12d, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L22:
	.cfi_restore_state
	addq	$2, %rdx
	movq	%rbp, %rdi
	movq	%rdx, 0(%rbp)
	call	term
	movl	%eax, %ebx
.L25:
	movq	0(%rbp), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	je	.L51
.L26:
	cmpb	$45, %dl
	jne	.L28
	movq	%rcx, 0(%rbp)
	movq	%rbp, %rdi
	call	term
	subl	%eax, %ebx
	movq	0(%rbp), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	jne	.L26
	.p2align 4,,10
	.p2align 3
.L51:
	movq	%rcx, 0(%rbp)
	movq	%rbp, %rdi
	call	term
	addl	%eax, %ebx
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L28:
	cmpb	$61, %dl
	cmovne	%rax, %rcx
	movl	%r12d, %eax
	cltd
	idivl	%ebx
	leaq	1(%rcx), %rsi
	movq	%rsi, 0(%rbp)
	movq	%rsi, %rdx
	movzbl	1(%rcx), %ecx
	movl	%eax, %r12d
	jmp	.L52
.L12:
	addq	$2, %rdx
	movq	%rbp, %rdi
	movq	%rdx, 0(%rbp)
	call	term
	movl	%eax, %ebx
.L15:
	movq	0(%rbp), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	je	.L53
.L16:
	cmpb	$45, %dl
	jne	.L18
	movq	%rcx, 0(%rbp)
	movq	%rbp, %rdi
	call	term
	subl	%eax, %ebx
	movq	0(%rbp), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	jne	.L16
	.p2align 4,,10
	.p2align 3
.L53:
	movq	%rcx, 0(%rbp)
	movq	%rbp, %rdi
	call	term
	addl	%eax, %ebx
	jmp	.L15
.L18:
	cmpb	$61, %dl
	cmovne	%rax, %rcx
	imull	%ebx, %r12d
	leaq	1(%rcx), %rdx
	movq	%rdx, 0(%rbp)
	movzbl	1(%rcx), %ecx
	jmp	.L10
.L2:
	addq	$1, %rdx
	movq	%rdx, (%rdi)
	call	term
	movl	%eax, %r12d
.L5:
	movq	0(%rbp), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	je	.L54
.L6:
	cmpb	$45, %dl
	jne	.L8
	movq	%rcx, 0(%rbp)
	movq	%rbp, %rdi
	call	term
	subl	%eax, %r12d
	movq	0(%rbp), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	jne	.L6
.L54:
	movq	%rcx, 0(%rbp)
	movq	%rbp, %rdi
	call	term
	addl	%eax, %r12d
	jmp	.L5
.L8:
	cmpb	$61, %dl
	cmovne	%rax, %rcx
	leaq	1(%rcx), %rdx
	movq	%rdx, 0(%rbp)
	movzbl	1(%rcx), %ecx
	jmp	.L10
.L50:
	movq	%rax, %rdx
	xorl	%r12d, %r12d
	jmp	.L10
.L49:
	jmp	.L45
	.cfi_endproc
	.section	.text.unlikely
	.cfi_startproc
	.type	term.cold, @function
term.cold:
.LFSB37:
.L45:
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	.cfi_offset 6, -24
	.cfi_offset 12, -16
	ud2
	.cfi_endproc
.LFE37:
	.text
	.size	term, .-term
	.section	.text.unlikely
	.size	term.cold, .-term.cold
.LCOLDE0:
	.text
.LHOTE0:
	.p2align 4
	.globl	expression
	.type	expression, @function
expression:
.LFB36:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	%rdi, %r8
	call	term
	movl	%eax, %r9d
.L56:
	movq	(%r8), %rax
	movzbl	(%rax), %edx
	cmpb	$43, %dl
	je	.L62
.L57:
	cmpb	$45, %dl
	jne	.L59
	addq	$1, %rax
	movq	%r8, %rdi
	movq	%rax, (%r8)
	call	term
	subl	%eax, %r9d
	movq	(%r8), %rax
	movzbl	(%rax), %edx
	cmpb	$43, %dl
	jne	.L57
.L62:
	addq	$1, %rax
	movq	%r8, %rdi
	movq	%rax, (%r8)
	call	term
	addl	%eax, %r9d
	jmp	.L56
	.p2align 4,,10
	.p2align 3
.L59:
	cmpb	$61, %dl
	jne	.L55
	addq	$1, %rax
	movq	%rax, (%r8)
.L55:
	movl	%r9d, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE36:
	.size	expression, .-expression
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.section	.text.unlikely
.LCOLDB4:
	.section	.text.startup,"ax",@progbits
.LHOTB4:
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC1(%rip), %rdi
	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
	addq	$-128, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L87
	xorl	%ebp, %ebp
	leaq	16(%rsp), %r12
	leaq	.LC2(%rip), %r14
	leaq	8(%rsp), %rbx
	leaq	.LC3(%rip), %r13
.L64:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	movq	%r12, 8(%rsp)
	call	term
	movq	8(%rsp), %rdi
	movl	%eax, %r10d
	movzbl	(%rdi), %ecx
.L65:
	cmpb	$43, %cl
	je	.L100
.L66:
	cmpb	$45, %cl
	jne	.L68
	leaq	1(%rdi), %rdx
	movq	%rdx, 8(%rsp)
	movsbl	1(%rdi), %ecx
	cmpb	$40, %cl
	je	.L69
	leal	-48(%rcx), %esi
	leaq	2(%rdi), %rax
	xorl	%r11d, %r11d
	movq	%rdx, %rdi
	cmpb	$9, %sil
	ja	.L72
	.p2align 4,,10
	.p2align 3
.L73:
	leal	(%r11,%r11,4), %edx
	movq	%rax, 8(%rsp)
	movq	%rax, %rdi
	addq	$1, %rax
	leal	-48(%rcx,%rdx,2), %r11d
	movsbl	-1(%rax), %ecx
	leal	-48(%rcx), %edx
	cmpb	$9, %dl
	jbe	.L73
.L72:
	cmpb	$42, %cl
	je	.L101
.L74:
	cmpb	$47, %cl
	jne	.L79
	leaq	1(%rdi), %rax
	movq	%rax, 8(%rsp)
	movsbl	1(%rdi), %ecx
	cmpb	$40, %cl
	je	.L80
	leal	-48(%rcx), %eax
	cmpb	$9, %al
	ja	.L102
	leaq	2(%rdi), %rax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L84:
	leal	(%rsi,%rsi,4), %edx
	movq	%rax, 8(%rsp)
	movq	%rax, %rdi
	addq	$1, %rax
	leal	-48(%rcx,%rdx,2), %esi
	movsbl	-1(%rax), %ecx
	leal	-48(%rcx), %edx
	cmpb	$9, %dl
	jbe	.L84
	movl	%r11d, %eax
	cltd
	idivl	%esi
	movl	%eax, %r11d
.L104:
	cmpb	$42, %cl
	jne	.L74
.L101:
	leaq	1(%rdi), %rax
	movq	%rax, 8(%rsp)
	movsbl	1(%rdi), %ecx
	cmpb	$40, %cl
	je	.L75
	leal	-48(%rcx), %esi
	xorl	%edx, %edx
	cmpb	$9, %sil
	ja	.L103
	.p2align 4,,10
	.p2align 3
.L76:
	addq	$1, %rax
	leal	(%rdx,%rdx,4), %edx
	movq	%rax, 8(%rsp)
	leal	-48(%rcx,%rdx,2), %edx
	movsbl	(%rax), %ecx
	leal	-48(%rcx), %esi
	cmpb	$9, %sil
	jbe	.L76
	imull	%edx, %r11d
	movq	%rax, %rdi
	jmp	.L72
	.p2align 4,,10
	.p2align 3
.L80:
	addq	$2, %rdi
	movq	%rdi, 8(%rsp)
	movq	%rbx, %rdi
	call	expression
	movl	%eax, %esi
	movq	8(%rsp), %rax
	leaq	1(%rax), %rdi
	movq	%rdi, 8(%rsp)
	movzbl	1(%rax), %ecx
	movl	%r11d, %eax
	cltd
	idivl	%esi
	movl	%eax, %r11d
	jmp	.L104
	.p2align 4,,10
	.p2align 3
.L79:
	subl	%r11d, %r10d
	cmpb	$43, %cl
	jne	.L66
.L100:
	addq	$1, %rdi
	movq	%rdi, 8(%rsp)
	movq	%rbx, %rdi
	call	term
	movq	8(%rsp), %rdi
	addl	%eax, %r10d
	movzbl	(%rdi), %ecx
	jmp	.L65
.L75:
	addq	$2, %rdi
	movq	%rdi, 8(%rsp)
	movq	%rbx, %rdi
	call	expression
	movl	%eax, %r8d
	movq	8(%rsp), %rax
	imull	%r8d, %r11d
	leaq	1(%rax), %rdi
	movq	%rdi, 8(%rsp)
	movzbl	1(%rax), %ecx
	jmp	.L72
.L103:
	movq	%rax, %rdi
	xorl	%r11d, %r11d
	jmp	.L72
.L69:
	addq	$2, %rdi
	movq	%rdi, 8(%rsp)
	movq	%rbx, %rdi
	call	expression
	movl	%eax, %r11d
	movq	8(%rsp), %rax
	leaq	1(%rax), %rdi
	movq	%rdi, 8(%rsp)
	movzbl	1(%rax), %ecx
	jmp	.L72
.L68:
	cmpb	$61, %cl
	jne	.L85
	addq	$1, %rdi
	movq	%rdi, 8(%rsp)
.L85:
	movl	%r10d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addl	$1, %ebp
	cmpl	%ebp, 4(%rsp)
	jg	.L64
.L87:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L105
	subq	$-128, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	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
.L105:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
.L102:
	jmp	.L96
	.cfi_endproc
	.section	.text.unlikely
	.cfi_startproc
	.type	main.cold, @function
main.cold:
.LFSB35:
.L96:
	.cfi_def_cfa_offset 176
	.cfi_offset 3, -48
	.cfi_offset 6, -40
	.cfi_offset 12, -32
	.cfi_offset 13, -24
	.cfi_offset 14, -16
	ud2
	.cfi_endproc
.LFE35:
	.section	.text.startup
	.size	main, .-main
	.section	.text.unlikely
	.size	main.cold, .-main.cold
.LCOLDE4:
	.section	.text.startup
.LHOTE4:
	.text
	.p2align 4
	.globl	factor
	.type	factor, @function
factor:
.LFB38:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rdx
	movq	%rdi, %r9
	movsbl	(%rdx), %eax
	cmpb	$40, %al
	je	.L107
	leal	-48(%rax), %ecx
	xorl	%r8d, %r8d
	cmpb	$9, %cl
	ja	.L121
	.p2align 4,,10
	.p2align 3
.L108:
	leal	(%r8,%r8,4), %ecx
	addq	$1, %rdx
	leal	-48(%rax,%rcx,2), %r8d
	movq	%rdx, (%r9)
	movsbl	(%rdx), %eax
	leal	-48(%rax), %ecx
	cmpb	$9, %cl
	jbe	.L108
.L121:
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L107:
	addq	$1, %rdx
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	%rdx, (%rdi)
	call	term
	movl	%eax, %r8d
.L110:
	movq	(%r9), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	je	.L123
.L111:
	cmpb	$45, %dl
	jne	.L113
	movq	%rcx, (%r9)
	movq	%r9, %rdi
	call	term
	subl	%eax, %r8d
	movq	(%r9), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	jne	.L111
.L123:
	movq	%rcx, (%r9)
	movq	%r9, %rdi
	call	term
	addl	%eax, %r8d
	jmp	.L110
	.p2align 4,,10
	.p2align 3
.L113:
	cmpb	$61, %dl
	cmovne	%rax, %rcx
	movl	%r8d, %eax
	addq	$1, %rcx
	movq	%rcx, (%r9)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE38:
	.size	factor, .-factor
	.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	.text.unlikely,"ax",@progbits
.LCOLDB0:
	.text
.LHOTB0:
	.p2align 4
	.globl	term
	.type	term, @function
term:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	(%rdi), %rdx
	movsbl	(%rdx), %ecx
	cmpb	$40, %cl
	je	.L2
	leal	-48(%rcx), %eax
	xorl	%r12d, %r12d
	cmpb	$9, %al
	ja	.L10
	.p2align 4,,10
	.p2align 3
.L3:
	leal	(%r12,%r12,4), %eax
	addq	$1, %rdx
	leal	-48(%rcx,%rax,2), %r12d
	movq	%rdx, 0(%rbp)
	movsbl	(%rdx), %ecx
	leal	-48(%rcx), %eax
	cmpb	$9, %al
	jbe	.L3
.L10:
	cmpb	$42, %cl
	je	.L48
.L11:
	cmpb	$47, %cl
	jne	.L1
	leaq	1(%rdx), %rsi
	movq	%rsi, 0(%rbp)
	movsbl	1(%rdx), %ecx
	cmpb	$40, %cl
	je	.L22
	leal	-48(%rcx), %eax
	cmpb	$9, %al
	ja	.L49
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L23:
	leal	(%rbx,%rbx,4), %eax
	addq	$1, %rsi
	leal	-48(%rcx,%rax,2), %ebx
	movq	%rsi, 0(%rbp)
	movsbl	(%rsi), %ecx
	leal	-48(%rcx), %eax
	cmpb	$9, %al
	jbe	.L23
	movl	%r12d, %eax
	cltd
	idivl	%ebx
	movq	%rsi, %rdx
	movl	%eax, %r12d
.L52:
	cmpb	$42, %cl
	jne	.L11
.L48:
	leaq	1(%rdx), %rax
	movq	%rax, 0(%rbp)
	movsbl	1(%rdx), %ecx
	cmpb	$40, %cl
	je	.L12
	leal	-48(%rcx), %esi
	xorl	%edx, %edx
	cmpb	$9, %sil
	ja	.L50
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$1, %rax
	leal	(%rdx,%rdx,4), %edx
	movq	%rax, 0(%rbp)
	leal	-48(%rcx,%rdx,2), %edx
	movsbl	(%rax), %ecx
	leal	-48(%rcx), %esi
	cmpb	$9, %sil
	jbe	.L13
	imull	%edx, %r12d
	movq	%rax, %rdx
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L1:
	movl	%r12d, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L22:
	.cfi_restore_state
	addq	$2, %rdx
	movq	%rbp, %rdi
	movq	%rdx, 0(%rbp)
	call	term
	movl	%eax, %ebx
.L25:
	movq	0(%rbp), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	je	.L51
.L26:
	cmpb	$45, %dl
	jne	.L28
	movq	%rcx, 0(%rbp)
	movq	%rbp, %rdi
	call	term
	subl	%eax, %ebx
	movq	0(%rbp), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	jne	.L26
	.p2align 4,,10
	.p2align 3
.L51:
	movq	%rcx, 0(%rbp)
	movq	%rbp, %rdi
	call	term
	addl	%eax, %ebx
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L28:
	cmpb	$61, %dl
	cmovne	%rax, %rcx
	movl	%r12d, %eax
	cltd
	idivl	%ebx
	leaq	1(%rcx), %rsi
	movq	%rsi, 0(%rbp)
	movq	%rsi, %rdx
	movzbl	1(%rcx), %ecx
	movl	%eax, %r12d
	jmp	.L52
.L12:
	addq	$2, %rdx
	movq	%rbp, %rdi
	movq	%rdx, 0(%rbp)
	call	term
	movl	%eax, %ebx
.L15:
	movq	0(%rbp), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	je	.L53
.L16:
	cmpb	$45, %dl
	jne	.L18
	movq	%rcx, 0(%rbp)
	movq	%rbp, %rdi
	call	term
	subl	%eax, %ebx
	movq	0(%rbp), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	jne	.L16
	.p2align 4,,10
	.p2align 3
.L53:
	movq	%rcx, 0(%rbp)
	movq	%rbp, %rdi
	call	term
	addl	%eax, %ebx
	jmp	.L15
.L18:
	cmpb	$61, %dl
	cmovne	%rax, %rcx
	imull	%ebx, %r12d
	leaq	1(%rcx), %rdx
	movq	%rdx, 0(%rbp)
	movzbl	1(%rcx), %ecx
	jmp	.L10
.L2:
	addq	$1, %rdx
	movq	%rdx, (%rdi)
	call	term
	movl	%eax, %r12d
.L5:
	movq	0(%rbp), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	je	.L54
.L6:
	cmpb	$45, %dl
	jne	.L8
	movq	%rcx, 0(%rbp)
	movq	%rbp, %rdi
	call	term
	subl	%eax, %r12d
	movq	0(%rbp), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	jne	.L6
.L54:
	movq	%rcx, 0(%rbp)
	movq	%rbp, %rdi
	call	term
	addl	%eax, %r12d
	jmp	.L5
.L8:
	cmpb	$61, %dl
	cmovne	%rax, %rcx
	leaq	1(%rcx), %rdx
	movq	%rdx, 0(%rbp)
	movzbl	1(%rcx), %ecx
	jmp	.L10
.L50:
	movq	%rax, %rdx
	xorl	%r12d, %r12d
	jmp	.L10
.L49:
	jmp	.L45
	.cfi_endproc
	.section	.text.unlikely
	.cfi_startproc
	.type	term.cold, @function
term.cold:
.LFSB37:
.L45:
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	.cfi_offset 6, -24
	.cfi_offset 12, -16
	ud2
	.cfi_endproc
.LFE37:
	.text
	.size	term, .-term
	.section	.text.unlikely
	.size	term.cold, .-term.cold
.LCOLDE0:
	.text
.LHOTE0:
	.p2align 4
	.globl	expression
	.type	expression, @function
expression:
.LFB36:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	%rdi, %r8
	call	term
	movl	%eax, %r9d
.L56:
	movq	(%r8), %rax
	movzbl	(%rax), %edx
	cmpb	$43, %dl
	je	.L62
.L57:
	cmpb	$45, %dl
	jne	.L59
	addq	$1, %rax
	movq	%r8, %rdi
	movq	%rax, (%r8)
	call	term
	subl	%eax, %r9d
	movq	(%r8), %rax
	movzbl	(%rax), %edx
	cmpb	$43, %dl
	jne	.L57
.L62:
	addq	$1, %rax
	movq	%r8, %rdi
	movq	%rax, (%r8)
	call	term
	addl	%eax, %r9d
	jmp	.L56
	.p2align 4,,10
	.p2align 3
.L59:
	cmpb	$61, %dl
	jne	.L55
	addq	$1, %rax
	movq	%rax, (%r8)
.L55:
	movl	%r9d, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE36:
	.size	expression, .-expression
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.section	.text.unlikely
.LCOLDB4:
	.section	.text.startup,"ax",@progbits
.LHOTB4:
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC1(%rip), %rdi
	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
	addq	$-128, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L87
	xorl	%ebp, %ebp
	leaq	16(%rsp), %r12
	leaq	.LC2(%rip), %r14
	leaq	8(%rsp), %rbx
	leaq	.LC3(%rip), %r13
.L64:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	movq	%r12, 8(%rsp)
	call	term
	movq	8(%rsp), %rdi
	movl	%eax, %r10d
	movzbl	(%rdi), %ecx
.L65:
	cmpb	$43, %cl
	je	.L100
.L66:
	cmpb	$45, %cl
	jne	.L68
	leaq	1(%rdi), %rdx
	movq	%rdx, 8(%rsp)
	movsbl	1(%rdi), %ecx
	cmpb	$40, %cl
	je	.L69
	leal	-48(%rcx), %esi
	leaq	2(%rdi), %rax
	xorl	%r11d, %r11d
	movq	%rdx, %rdi
	cmpb	$9, %sil
	ja	.L72
	.p2align 4,,10
	.p2align 3
.L73:
	leal	(%r11,%r11,4), %edx
	movq	%rax, 8(%rsp)
	movq	%rax, %rdi
	addq	$1, %rax
	leal	-48(%rcx,%rdx,2), %r11d
	movsbl	-1(%rax), %ecx
	leal	-48(%rcx), %edx
	cmpb	$9, %dl
	jbe	.L73
.L72:
	cmpb	$42, %cl
	je	.L101
.L74:
	cmpb	$47, %cl
	jne	.L79
	leaq	1(%rdi), %rax
	movq	%rax, 8(%rsp)
	movsbl	1(%rdi), %ecx
	cmpb	$40, %cl
	je	.L80
	leal	-48(%rcx), %eax
	cmpb	$9, %al
	ja	.L102
	leaq	2(%rdi), %rax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L84:
	leal	(%rsi,%rsi,4), %edx
	movq	%rax, 8(%rsp)
	movq	%rax, %rdi
	addq	$1, %rax
	leal	-48(%rcx,%rdx,2), %esi
	movsbl	-1(%rax), %ecx
	leal	-48(%rcx), %edx
	cmpb	$9, %dl
	jbe	.L84
	movl	%r11d, %eax
	cltd
	idivl	%esi
	movl	%eax, %r11d
.L104:
	cmpb	$42, %cl
	jne	.L74
.L101:
	leaq	1(%rdi), %rax
	movq	%rax, 8(%rsp)
	movsbl	1(%rdi), %ecx
	cmpb	$40, %cl
	je	.L75
	leal	-48(%rcx), %esi
	xorl	%edx, %edx
	cmpb	$9, %sil
	ja	.L103
	.p2align 4,,10
	.p2align 3
.L76:
	addq	$1, %rax
	leal	(%rdx,%rdx,4), %edx
	movq	%rax, 8(%rsp)
	leal	-48(%rcx,%rdx,2), %edx
	movsbl	(%rax), %ecx
	leal	-48(%rcx), %esi
	cmpb	$9, %sil
	jbe	.L76
	imull	%edx, %r11d
	movq	%rax, %rdi
	jmp	.L72
	.p2align 4,,10
	.p2align 3
.L80:
	addq	$2, %rdi
	movq	%rdi, 8(%rsp)
	movq	%rbx, %rdi
	call	expression
	movl	%eax, %esi
	movq	8(%rsp), %rax
	leaq	1(%rax), %rdi
	movq	%rdi, 8(%rsp)
	movzbl	1(%rax), %ecx
	movl	%r11d, %eax
	cltd
	idivl	%esi
	movl	%eax, %r11d
	jmp	.L104
	.p2align 4,,10
	.p2align 3
.L79:
	subl	%r11d, %r10d
	cmpb	$43, %cl
	jne	.L66
.L100:
	addq	$1, %rdi
	movq	%rdi, 8(%rsp)
	movq	%rbx, %rdi
	call	term
	movq	8(%rsp), %rdi
	addl	%eax, %r10d
	movzbl	(%rdi), %ecx
	jmp	.L65
.L75:
	addq	$2, %rdi
	movq	%rdi, 8(%rsp)
	movq	%rbx, %rdi
	call	expression
	movl	%eax, %r8d
	movq	8(%rsp), %rax
	imull	%r8d, %r11d
	leaq	1(%rax), %rdi
	movq	%rdi, 8(%rsp)
	movzbl	1(%rax), %ecx
	jmp	.L72
.L103:
	movq	%rax, %rdi
	xorl	%r11d, %r11d
	jmp	.L72
.L69:
	addq	$2, %rdi
	movq	%rdi, 8(%rsp)
	movq	%rbx, %rdi
	call	expression
	movl	%eax, %r11d
	movq	8(%rsp), %rax
	leaq	1(%rax), %rdi
	movq	%rdi, 8(%rsp)
	movzbl	1(%rax), %ecx
	jmp	.L72
.L68:
	cmpb	$61, %cl
	jne	.L85
	addq	$1, %rdi
	movq	%rdi, 8(%rsp)
.L85:
	movl	%r10d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addl	$1, %ebp
	cmpl	%ebp, 4(%rsp)
	jg	.L64
.L87:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L105
	subq	$-128, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	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
.L105:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
.L102:
	jmp	.L96
	.cfi_endproc
	.section	.text.unlikely
	.cfi_startproc
	.type	main.cold, @function
main.cold:
.LFSB35:
.L96:
	.cfi_def_cfa_offset 176
	.cfi_offset 3, -48
	.cfi_offset 6, -40
	.cfi_offset 12, -32
	.cfi_offset 13, -24
	.cfi_offset 14, -16
	ud2
	.cfi_endproc
.LFE35:
	.section	.text.startup
	.size	main, .-main
	.section	.text.unlikely
	.size	main.cold, .-main.cold
.LCOLDE4:
	.section	.text.startup
.LHOTE4:
	.text
	.p2align 4
	.globl	factor
	.type	factor, @function
factor:
.LFB38:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rdx
	movq	%rdi, %r9
	movsbl	(%rdx), %eax
	cmpb	$40, %al
	je	.L107
	leal	-48(%rax), %ecx
	xorl	%r8d, %r8d
	cmpb	$9, %cl
	ja	.L121
	.p2align 4,,10
	.p2align 3
.L108:
	leal	(%r8,%r8,4), %ecx
	addq	$1, %rdx
	leal	-48(%rax,%rcx,2), %r8d
	movq	%rdx, (%r9)
	movsbl	(%rdx), %eax
	leal	-48(%rax), %ecx
	cmpb	$9, %cl
	jbe	.L108
.L121:
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L107:
	addq	$1, %rdx
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	%rdx, (%rdi)
	call	term
	movl	%eax, %r8d
.L110:
	movq	(%r9), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	je	.L123
.L111:
	cmpb	$45, %dl
	jne	.L113
	movq	%rcx, (%r9)
	movq	%r9, %rdi
	call	term
	subl	%eax, %r8d
	movq	(%r9), %rax
	movzbl	(%rax), %edx
	leaq	1(%rax), %rcx
	cmpb	$43, %dl
	jne	.L111
.L123:
	movq	%rcx, (%r9)
	movq	%r9, %rdi
	call	term
	addl	%eax, %r8d
	jmp	.L110
	.p2align 4,,10
	.p2align 3
.L113:
	cmpb	$61, %dl
	cmovne	%rax, %rcx
	movl	%r8d, %eax
	addq	$1, %rcx
	movq	%rcx, (%r9)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE38:
	.size	factor, .-factor
	.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:

// AOJ Volume 1 Problem 0109

#include <stdio.h>
#include <string.h>

int expression(char **form);
int term(char **form);
int factor(char **form);

int main(void)
{
	char formula[101];
	int n;
	int i;
	char *p;
	int result;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%s", formula);

		p = formula;
		result = expression(&p);
		printf("%d\n", result);
	}
	
	return (0);
}

int expression(char **form)
{
	int result;

	result = term(form);
	
	while (1){
		if (**form == '+'){
			(*form)++;
			result += term(form);
		}
		else if (**form == '-'){
			(*form)++;
			result -= term(form);
		}
		else if (**form == '='){
			(*form)++;
			break;
		}
		else {
			break;
		}
	}

	return (result);
}

int term(char **form)
{
	int result;
	

	result = factor(form);
	
	while (1){
		if (**form == '*'){
			(*form)++;
			result *= factor(form);
		}
		else if (**form == '/'){
			(*form)++;
			result /= factor(form);
		}
		else {
			break;
		}
	}
	return (result);
}

int factor(char **form)
{
	int result;
	
	if (**form == '('){
		(*form)++;
		result = expression(form);
		(*form)++;		// skip ')'
	}
	else {
		result = 0;
		while ('0' <= **form && **form <= '9'){
			result = result * 10 + **form - '0';
			(*form)++;
		}
	}
	
	return (result);
}
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
// AOJ Volume 1 Problem 0109

#include <stdio.h>
#include <string.h>

int expression(char **form);
int term(char **form);
int factor(char **form);

int main(void)
{
	char formula[101];
	int n;
	int i;
	char *p;
	int result;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%s", formula);

		p = formula;
		result = expression(&p);
		printf("%d\n", result);
	}
	
	return (0);
}

int expression(char **form)
{
	int result;

	result = term(form);
	
	while (1){
		if (**form == '+'){
			(*form)++;
			result += term(form);
		}
		else if (**form == '-'){
			(*form)++;
			result -= term(form);
		}
		else if (**form == '='){
			(*form)++;
			break;
		}
		else {
			break;
		}
	}

	return (result);
}

int term(char **form)
{
	int result;
	

	result = factor(form);
	
	while (1){
		if (**form == '*'){
			(*form)++;
			result *= factor(form);
		}
		else if (**form == '/'){
			(*form)++;
			result /= factor(form);
		}
		else {
			break;
		}
	}
	return (result);
}

int factor(char **form)
{
	int result;
	
	if (**form == '('){
		(*form)++;
		result = expression(form);
		(*form)++;		// skip ')'
	}
	else {
		result = 0;
		while ('0' <= **form && **form <= '9'){
			result = result * 10 + **form - '0';
			(*form)++;
		}
	}
	
	return (result);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.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	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-132(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -128(%rbp)
	jmp	.L2
.L3:
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-112(%rbp), %rax
	movq	%rax, -120(%rbp)
	leaq	-120(%rbp), %rax
	movq	%rax, %rdi
	call	expression
	movl	%eax, -124(%rbp)
	movl	-124(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -128(%rbp)
.L2:
	movl	-132(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L3
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	expression
	.type	expression, @function
expression:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	term
	movl	%eax, -4(%rbp)
.L12:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$43, %al
	jne	.L7
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	term
	addl	%eax, -4(%rbp)
	jmp	.L12
.L7:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$45, %al
	jne	.L9
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	term
	subl	%eax, -4(%rbp)
	jmp	.L12
.L9:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$61, %al
	jne	.L14
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	jmp	.L11
.L14:
	nop
.L11:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	expression, .-expression
	.globl	term
	.type	term, @function
term:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	factor
	movl	%eax, -4(%rbp)
.L20:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$42, %al
	jne	.L16
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	factor
	movl	-4(%rbp), %edx
	imull	%edx, %eax
	movl	%eax, -4(%rbp)
	jmp	.L20
.L16:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jne	.L22
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	factor
	movl	%eax, %ecx
	movl	-4(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, -4(%rbp)
	jmp	.L20
.L22:
	nop
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	term, .-term
	.globl	factor
	.type	factor, @function
factor:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$40, %al
	jne	.L24
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	expression
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	jmp	.L25
.L24:
	movl	$0, -4(%rbp)
	jmp	.L26
.L27:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
.L26:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jle	.L25
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$57, %al
	jle	.L27
.L25:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	factor, .-factor
	.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"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.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	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-132(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -128(%rbp)
	jmp	.L2
.L3:
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-112(%rbp), %rax
	movq	%rax, -120(%rbp)
	leaq	-120(%rbp), %rax
	movq	%rax, %rdi
	call	expression
	movl	%eax, -124(%rbp)
	movl	-124(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -128(%rbp)
.L2:
	movl	-132(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L3
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	expression
	.type	expression, @function
expression:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	term
	movl	%eax, -4(%rbp)
.L12:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$43, %al
	jne	.L7
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	term
	addl	%eax, -4(%rbp)
	jmp	.L12
.L7:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$45, %al
	jne	.L9
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	term
	subl	%eax, -4(%rbp)
	jmp	.L12
.L9:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$61, %al
	jne	.L14
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	jmp	.L11
.L14:
	nop
.L11:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	expression, .-expression
	.globl	term
	.type	term, @function
term:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	factor
	movl	%eax, -4(%rbp)
.L20:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$42, %al
	jne	.L16
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	factor
	movl	-4(%rbp), %edx
	imull	%edx, %eax
	movl	%eax, -4(%rbp)
	jmp	.L20
.L16:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jne	.L22
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	factor
	movl	%eax, %ecx
	movl	-4(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, -4(%rbp)
	jmp	.L20
.L22:
	nop
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	term, .-term
	.globl	factor
	.type	factor, @function
factor:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$40, %al
	jne	.L24
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	expression
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	jmp	.L25
.L24:
	movl	$0, -4(%rbp)
	jmp	.L26
.L27:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
.L26:
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jle	.L25
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movzbl	(%rax), %eax
	cmpb	$57, %al
	jle	.L27
.L25:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	factor, .-factor
	.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:
