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 <string.h>

int eval(char *ex, int first, int last);
int term(char *ex, int first, int last);
int factor(char *ex, int first, int last);
int literal(char *ex, int first, int last);
int find_open(char *ex, int first, int last);

int main(void)
{
	char expr[128];
	int n, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf(" %s", expr);
		printf("%d\n", eval(expr, 0, strlen(expr) - 2));
	}

	return (0);
}

int eval(char *ex, int first, int last)
{
	int i;

	for (i = last; i >= first; i--){
		if (ex[i] == ')'){
			i = find_open(ex, first, i - 1) - 1;
		}
		if (ex[i] == '+') return (eval(ex, first, i - 1) + term(ex, i + 1, last));
		if (ex[i] == '-') return (eval(ex, first, i - 1) - term(ex, i + 1, last));
	}
	return (term(ex, first, last));
}

int term(char *ex, int first, int last)
{
	int i;

	for (i = last; i >= first; i--){
		if (ex[i] == ')'){
			i = find_open(ex, first, i - 1) - 1;
		}
		if (ex[i] == '*') return (term(ex, first, i - 1) * factor(ex, i + 1, last));
		if (ex[i] == '/') return (term(ex, first, i - 1) / factor(ex, i + 1, last));
	}
	return (factor(ex, first, last));
}

int factor(char *ex, int first, int last)
{
	if (ex[first] == '('){
		return (eval(ex, first + 1, last - 1));
	}
	return (atoi(ex + first));
}

int find_open(char *ex, int first, int last)
{
	int close;
	int i;

	close = 0;
	for (i = last; i >= first; i--){
		if (ex[i] == ')') close++;
		if (ex[i] == '('){
			if (close == 0){
				return (i);
			}
			close--;
		}
	}
	return (-1);
}```

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	$160, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-152(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -148(%rbp)
	jmp	.L2
.L3:
	leaq	-144(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subl	$2, %eax
	movl	%eax, %edx
	leaq	-144(%rbp), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	eval
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -148(%rbp)
.L2:
	movl	-152(%rbp), %eax
	cmpl	%eax, -148(%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	eval
	.type	eval, @function
eval:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L7
.L12:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$41, %al
	jne	.L8
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	find_open
	subl	$1, %eax
	movl	%eax, -20(%rbp)
.L8:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$43, %al
	jne	.L9
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	eval
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
	addl	%ebx, %eax
	jmp	.L10
.L9:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$45, %al
	jne	.L11
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	eval
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
	movl	%eax, %edx
	movl	%ebx, %eax
	subl	%edx, %eax
	jmp	.L10
.L11:
	subl	$1, -20(%rbp)
.L7:
	movl	-20(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	.L12
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
.L10:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	eval, .-eval
	.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
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L14
.L19:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$41, %al
	jne	.L15
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	find_open
	subl	$1, %eax
	movl	%eax, -20(%rbp)
.L15:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$42, %al
	jne	.L16
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	factor
	imull	%ebx, %eax
	jmp	.L17
.L16:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jne	.L18
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	factor
	movl	%eax, %esi
	movl	%ebx, %eax
	cltd
	idivl	%esi
	jmp	.L17
.L18:
	subl	$1, -20(%rbp)
.L14:
	movl	-20(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	.L19
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	factor
.L17:
	movq	-8(%rbp), %rbx
	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	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	%edx, -16(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$40, %al
	jne	.L21
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-12(%rbp), %eax
	leal	1(%rax), %ecx
	movq	-8(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	eval
	jmp	.L22
.L21:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	atoi@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	factor, .-factor
	.globl	find_open
	.type	find_open, @function
find_open:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$0, -8(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -4(%rbp)
	jmp	.L24
.L29:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$41, %al
	jne	.L25
	addl	$1, -8(%rbp)
.L25:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$40, %al
	jne	.L26
	cmpl	$0, -8(%rbp)
	jne	.L27
	movl	-4(%rbp), %eax
	jmp	.L28
.L27:
	subl	$1, -8(%rbp)
.L26:
	subl	$1, -4(%rbp)
.L24:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jge	.L29
	movl	$-1, %eax
.L28:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	find_open, .-find_open
	.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:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	cmpl	%esi, %edx
	jge	.L16
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	cmpb	$42, %al
	je	.L24
.L9:
	cmpb	$47, %al
	je	.L25
	cmpl	%edx, %esi
	jg	.L2
.L16:
	movslq	%edx, %rax
	movl	%edx, %ebx
	subl	$1, %edx
	movzbl	0(%rbp,%rax), %eax
	cmpb	$41, %al
	jne	.L3
	cmpl	%edx, %esi
	jg	.L19
	movslq	%edx, %rdx
	xorl	%ecx, %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$40, %al
	jne	.L6
	testl	%ecx, %ecx
	je	.L26
	subl	$1, %ecx
.L6:
	subq	$1, %rdx
	cmpl	%edx, %esi
	jg	.L19
.L8:
	movzbl	0(%rbp,%rdx), %eax
	cmpb	$41, %al
	jne	.L5
	subq	$1, %rdx
	addl	$1, %ecx
	cmpl	%edx, %esi
	jle	.L8
.L19:
	movl	$-3, %edx
	movq	$-2, %rax
	movl	$-2, %ebx
.L4:
	movzbl	0(%rbp,%rax), %eax
	cmpb	$42, %al
	jne	.L9
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rbp, %rdi
	call	term
	leal	1(%rbx), %edi
	movslq	%edi, %rdi
	movl	%eax, %r13d
	addq	%rbp, %rdi
	cmpb	$40, (%rdi)
	je	.L27
	xorl	%eax, %eax
	call	atoi@PLT
.L11:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	imull	%r13d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	leal	-1(%rdx), %ebx
	leal	-2(%rdx), %edx
	movslq	%ebx, %rax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	movslq	%esi, %rdi
	addq	%rbp, %rdi
	cmpb	$40, (%rdi)
	je	.L28
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	atoi@PLT
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	movq	%rbp, %rdi
	call	term
	leal	1(%rbx), %edi
	movslq	%edi, %rdi
	movl	%eax, %r13d
	addq	%rbp, %rdi
	cmpb	$40, (%rdi)
	je	.L29
	xorl	%eax, %eax
	call	atoi@PLT
	movl	%eax, %ecx
.L15:
	movl	%r13d, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	cltd
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	idivl	%ecx
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	leal	-1(%r12), %edx
	movq	%rbp, %rdi
	addl	$1, %esi
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	eval
.L27:
	.cfi_restore_state
	leal	-1(%r12), %edx
	leal	2(%rbx), %esi
	movq	%rbp, %rdi
	call	eval
	jmp	.L11
.L29:
	leal	-1(%r12), %edx
	leal	2(%rbx), %esi
	movq	%rbp, %rdi
	call	eval
	movl	%eax, %ecx
	jmp	.L15
	.cfi_endproc
.LFE37:
	.size	term, .-term
	.p2align 4
	.globl	eval
	.type	eval, @function
eval:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	cmpl	%esi, %edx
	jge	.L41
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L32:
	cmpb	$43, %al
	je	.L47
.L38:
	cmpb	$45, %al
	je	.L48
	cmpl	%edx, %esi
	jg	.L31
.L41:
	movslq	%edx, %rax
	movl	%edx, %ebx
	subl	$1, %edx
	movzbl	0(%rbp,%rax), %eax
	cmpb	$41, %al
	jne	.L32
	cmpl	%edx, %esi
	jg	.L43
	movslq	%edx, %rdx
	xorl	%ecx, %ecx
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L34:
	cmpb	$40, %al
	jne	.L35
	testl	%ecx, %ecx
	je	.L49
	subl	$1, %ecx
.L35:
	subq	$1, %rdx
	cmpl	%edx, %esi
	jg	.L43
.L37:
	movzbl	0(%rbp,%rdx), %eax
	cmpb	$41, %al
	jne	.L34
	subq	$1, %rdx
	addl	$1, %ecx
	cmpl	%edx, %esi
	jle	.L37
.L43:
	movl	$-3, %edx
	movq	$-2, %rax
	movl	$-2, %ebx
.L33:
	movzbl	0(%rbp,%rax), %eax
	cmpb	$43, %al
	jne	.L38
.L47:
	movq	%rbp, %rdi
	call	eval
	leal	1(%rbx), %esi
	movl	%r12d, %edx
	movq	%rbp, %rdi
	movl	%eax, %r13d
	call	term
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	addl	%r13d, %eax
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L49:
	.cfi_restore_state
	leal	-1(%rdx), %ebx
	leal	-2(%rdx), %edx
	movslq	%ebx, %rax
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L31:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r12d, %edx
	movq	%rbp, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	term
	.p2align 4,,10
	.p2align 3
.L48:
	.cfi_restore_state
	movq	%rbp, %rdi
	call	eval
	leal	1(%rbx), %esi
	movl	%r12d, %edx
	movq	%rbp, %rdi
	movl	%eax, %r13d
	call	term
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	movl	%eax, %r8d
	movl	%r13d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	subl	%r8d, %eax
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE36:
	.size	eval, .-eval
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	" %s"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$168, %rsp
	.cfi_def_cfa_offset 208
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L51
	xorl	%r13d, %r13d
	leaq	16(%rsp), %rbx
	leaq	.LC1(%rip), %r12
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L52:
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	xorl	%esi, %esi
	movq	%rbx, %rdi
	leal	-2(%rax), %edx
	call	eval
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpl	%r13d, 12(%rsp)
	jg	.L52
.L51:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L56
	addq	$168, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L56:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.text
	.p2align 4
	.globl	factor
	.type	factor, @function
factor:
.LFB38:
	.cfi_startproc
	endbr64
	movslq	%esi, %rax
	movq	%rdi, %r8
	leaq	(%rdi,%rax), %rdi
	cmpb	$40, (%rdi)
	je	.L59
	xorl	%eax, %eax
	jmp	atoi@PLT
	.p2align 4,,10
	.p2align 3
.L59:
	subl	$1, %edx
	addl	$1, %esi
	movq	%r8, %rdi
	jmp	eval
	.cfi_endproc
.LFE38:
	.size	factor, .-factor
	.p2align 4
	.globl	find_open
	.type	find_open, @function
find_open:
.LFB39:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edx
	jl	.L65
	movslq	%edx, %rdx
	xorl	%ecx, %ecx
	jmp	.L64
	.p2align 4,,10
	.p2align 3
.L62:
	cmpb	$40, %al
	jne	.L63
	testl	%ecx, %ecx
	je	.L60
	subl	$1, %ecx
.L63:
	subq	$1, %rdx
	cmpl	%edx, %esi
	jg	.L65
.L64:
	movzbl	(%rdi,%rdx), %eax
	movl	%edx, %r8d
	cmpb	$41, %al
	jne	.L62
	subq	$1, %rdx
	addl	$1, %ecx
	cmpl	%edx, %esi
	jle	.L64
.L65:
	movl	$-1, %r8d
.L60:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	find_open, .-find_open
	.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:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	cmpl	%esi, %edx
	jge	.L16
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	cmpb	$42, %al
	je	.L24
.L9:
	cmpb	$47, %al
	je	.L25
	cmpl	%edx, %esi
	jg	.L2
.L16:
	movslq	%edx, %rax
	movl	%edx, %ebx
	subl	$1, %edx
	movzbl	0(%rbp,%rax), %eax
	cmpb	$41, %al
	jne	.L3
	cmpl	%edx, %esi
	jg	.L19
	movslq	%edx, %rdx
	xorl	%ecx, %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$40, %al
	jne	.L6
	testl	%ecx, %ecx
	je	.L26
	subl	$1, %ecx
.L6:
	subq	$1, %rdx
	cmpl	%edx, %esi
	jg	.L19
.L8:
	movzbl	0(%rbp,%rdx), %eax
	cmpb	$41, %al
	jne	.L5
	subq	$1, %rdx
	addl	$1, %ecx
	cmpl	%edx, %esi
	jle	.L8
.L19:
	movl	$-3, %edx
	movq	$-2, %rax
	movl	$-2, %ebx
.L4:
	movzbl	0(%rbp,%rax), %eax
	cmpb	$42, %al
	jne	.L9
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rbp, %rdi
	call	term
	leal	1(%rbx), %edi
	movslq	%edi, %rdi
	movl	%eax, %r13d
	addq	%rbp, %rdi
	cmpb	$40, (%rdi)
	je	.L27
	xorl	%eax, %eax
	call	atoi@PLT
.L11:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	imull	%r13d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	leal	-1(%rdx), %ebx
	leal	-2(%rdx), %edx
	movslq	%ebx, %rax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	movslq	%esi, %rdi
	addq	%rbp, %rdi
	cmpb	$40, (%rdi)
	je	.L28
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	atoi@PLT
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	movq	%rbp, %rdi
	call	term
	leal	1(%rbx), %edi
	movslq	%edi, %rdi
	movl	%eax, %r13d
	addq	%rbp, %rdi
	cmpb	$40, (%rdi)
	je	.L29
	xorl	%eax, %eax
	call	atoi@PLT
	movl	%eax, %ecx
.L15:
	movl	%r13d, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	cltd
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	idivl	%ecx
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	leal	-1(%r12), %edx
	movq	%rbp, %rdi
	addl	$1, %esi
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	eval
.L27:
	.cfi_restore_state
	leal	-1(%r12), %edx
	leal	2(%rbx), %esi
	movq	%rbp, %rdi
	call	eval
	jmp	.L11
.L29:
	leal	-1(%r12), %edx
	leal	2(%rbx), %esi
	movq	%rbp, %rdi
	call	eval
	movl	%eax, %ecx
	jmp	.L15
	.cfi_endproc
.LFE37:
	.size	term, .-term
	.p2align 4
	.globl	eval
	.type	eval, @function
eval:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	cmpl	%esi, %edx
	jge	.L41
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L32:
	cmpb	$43, %al
	je	.L47
.L38:
	cmpb	$45, %al
	je	.L48
	cmpl	%edx, %esi
	jg	.L31
.L41:
	movslq	%edx, %rax
	movl	%edx, %ebx
	subl	$1, %edx
	movzbl	0(%rbp,%rax), %eax
	cmpb	$41, %al
	jne	.L32
	cmpl	%edx, %esi
	jg	.L43
	movslq	%edx, %rdx
	xorl	%ecx, %ecx
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L34:
	cmpb	$40, %al
	jne	.L35
	testl	%ecx, %ecx
	je	.L49
	subl	$1, %ecx
.L35:
	subq	$1, %rdx
	cmpl	%edx, %esi
	jg	.L43
.L37:
	movzbl	0(%rbp,%rdx), %eax
	cmpb	$41, %al
	jne	.L34
	subq	$1, %rdx
	addl	$1, %ecx
	cmpl	%edx, %esi
	jle	.L37
.L43:
	movl	$-3, %edx
	movq	$-2, %rax
	movl	$-2, %ebx
.L33:
	movzbl	0(%rbp,%rax), %eax
	cmpb	$43, %al
	jne	.L38
.L47:
	movq	%rbp, %rdi
	call	eval
	leal	1(%rbx), %esi
	movl	%r12d, %edx
	movq	%rbp, %rdi
	movl	%eax, %r13d
	call	term
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	addl	%r13d, %eax
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L49:
	.cfi_restore_state
	leal	-1(%rdx), %ebx
	leal	-2(%rdx), %edx
	movslq	%ebx, %rax
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L31:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r12d, %edx
	movq	%rbp, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	term
	.p2align 4,,10
	.p2align 3
.L48:
	.cfi_restore_state
	movq	%rbp, %rdi
	call	eval
	leal	1(%rbx), %esi
	movl	%r12d, %edx
	movq	%rbp, %rdi
	movl	%eax, %r13d
	call	term
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	movl	%eax, %r8d
	movl	%r13d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	subl	%r8d, %eax
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE36:
	.size	eval, .-eval
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	" %s"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$168, %rsp
	.cfi_def_cfa_offset 208
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L51
	xorl	%r13d, %r13d
	leaq	16(%rsp), %rbx
	leaq	.LC1(%rip), %r12
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L52:
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	xorl	%esi, %esi
	movq	%rbx, %rdi
	leal	-2(%rax), %edx
	call	eval
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpl	%r13d, 12(%rsp)
	jg	.L52
.L51:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L56
	addq	$168, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L56:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.text
	.p2align 4
	.globl	factor
	.type	factor, @function
factor:
.LFB38:
	.cfi_startproc
	endbr64
	movslq	%esi, %rax
	movq	%rdi, %r8
	leaq	(%rdi,%rax), %rdi
	cmpb	$40, (%rdi)
	je	.L59
	xorl	%eax, %eax
	jmp	atoi@PLT
	.p2align 4,,10
	.p2align 3
.L59:
	subl	$1, %edx
	addl	$1, %esi
	movq	%r8, %rdi
	jmp	eval
	.cfi_endproc
.LFE38:
	.size	factor, .-factor
	.p2align 4
	.globl	find_open
	.type	find_open, @function
find_open:
.LFB39:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edx
	jl	.L65
	movslq	%edx, %rdx
	xorl	%ecx, %ecx
	jmp	.L64
	.p2align 4,,10
	.p2align 3
.L62:
	cmpb	$40, %al
	jne	.L63
	testl	%ecx, %ecx
	je	.L60
	subl	$1, %ecx
.L63:
	subq	$1, %rdx
	cmpl	%edx, %esi
	jg	.L65
.L64:
	movzbl	(%rdi,%rdx), %eax
	movl	%edx, %r8d
	cmpb	$41, %al
	jne	.L62
	subq	$1, %rdx
	addl	$1, %ecx
	cmpl	%edx, %esi
	jle	.L64
.L65:
	movl	$-1, %r8d
.L60:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	find_open, .-find_open
	.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 <string.h>

int eval(char *ex, int first, int last);
int term(char *ex, int first, int last);
int factor(char *ex, int first, int last);
int literal(char *ex, int first, int last);
int find_open(char *ex, int first, int last);

int main(void)
{
	char expr[128];
	int n, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf(" %s", expr);
		printf("%d\n", eval(expr, 0, strlen(expr) - 2));
	}

	return (0);
}

int eval(char *ex, int first, int last)
{
	int i;

	for (i = last; i >= first; i--){
		if (ex[i] == ')'){
			i = find_open(ex, first, i - 1) - 1;
		}
		if (ex[i] == '+') return (eval(ex, first, i - 1) + term(ex, i + 1, last));
		if (ex[i] == '-') return (eval(ex, first, i - 1) - term(ex, i + 1, last));
	}
	return (term(ex, first, last));
}

int term(char *ex, int first, int last)
{
	int i;

	for (i = last; i >= first; i--){
		if (ex[i] == ')'){
			i = find_open(ex, first, i - 1) - 1;
		}
		if (ex[i] == '*') return (term(ex, first, i - 1) * factor(ex, i + 1, last));
		if (ex[i] == '/') return (term(ex, first, i - 1) / factor(ex, i + 1, last));
	}
	return (factor(ex, first, last));
}

int factor(char *ex, int first, int last)
{
	if (ex[first] == '('){
		return (eval(ex, first + 1, last - 1));
	}
	return (atoi(ex + first));
}

int find_open(char *ex, int first, int last)
{
	int close;
	int i;

	close = 0;
	for (i = last; i >= first; i--){
		if (ex[i] == ')') close++;
		if (ex[i] == '('){
			if (close == 0){
				return (i);
			}
			close--;
		}
	}
	return (-1);
}
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>
#include <string.h>

int eval(char *ex, int first, int last);
int term(char *ex, int first, int last);
int factor(char *ex, int first, int last);
int literal(char *ex, int first, int last);
int find_open(char *ex, int first, int last);

int main(void)
{
	char expr[128];
	int n, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf(" %s", expr);
		printf("%d\n", eval(expr, 0, strlen(expr) - 2));
	}

	return (0);
}

int eval(char *ex, int first, int last)
{
	int i;

	for (i = last; i >= first; i--){
		if (ex[i] == ')'){
			i = find_open(ex, first, i - 1) - 1;
		}
		if (ex[i] == '+') return (eval(ex, first, i - 1) + term(ex, i + 1, last));
		if (ex[i] == '-') return (eval(ex, first, i - 1) - term(ex, i + 1, last));
	}
	return (term(ex, first, last));
}

int term(char *ex, int first, int last)
{
	int i;

	for (i = last; i >= first; i--){
		if (ex[i] == ')'){
			i = find_open(ex, first, i - 1) - 1;
		}
		if (ex[i] == '*') return (term(ex, first, i - 1) * factor(ex, i + 1, last));
		if (ex[i] == '/') return (term(ex, first, i - 1) / factor(ex, i + 1, last));
	}
	return (factor(ex, first, last));
}

int factor(char *ex, int first, int last)
{
	if (ex[first] == '('){
		return (eval(ex, first + 1, last - 1));
	}
	return (atoi(ex + first));
}

int find_open(char *ex, int first, int last)
{
	int close;
	int i;

	close = 0;
	for (i = last; i >= first; i--){
		if (ex[i] == ')') close++;
		if (ex[i] == '('){
			if (close == 0){
				return (i);
			}
			close--;
		}
	}
	return (-1);
}```

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	$160, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-152(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -148(%rbp)
	jmp	.L2
.L3:
	leaq	-144(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subl	$2, %eax
	movl	%eax, %edx
	leaq	-144(%rbp), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	eval
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -148(%rbp)
.L2:
	movl	-152(%rbp), %eax
	cmpl	%eax, -148(%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	eval
	.type	eval, @function
eval:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L7
.L12:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$41, %al
	jne	.L8
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	find_open
	subl	$1, %eax
	movl	%eax, -20(%rbp)
.L8:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$43, %al
	jne	.L9
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	eval
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
	addl	%ebx, %eax
	jmp	.L10
.L9:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$45, %al
	jne	.L11
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	eval
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
	movl	%eax, %edx
	movl	%ebx, %eax
	subl	%edx, %eax
	jmp	.L10
.L11:
	subl	$1, -20(%rbp)
.L7:
	movl	-20(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	.L12
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
.L10:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	eval, .-eval
	.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
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L14
.L19:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$41, %al
	jne	.L15
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	find_open
	subl	$1, %eax
	movl	%eax, -20(%rbp)
.L15:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$42, %al
	jne	.L16
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	factor
	imull	%ebx, %eax
	jmp	.L17
.L16:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jne	.L18
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	factor
	movl	%eax, %esi
	movl	%ebx, %eax
	cltd
	idivl	%esi
	jmp	.L17
.L18:
	subl	$1, -20(%rbp)
.L14:
	movl	-20(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	.L19
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	factor
.L17:
	movq	-8(%rbp), %rbx
	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	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	%edx, -16(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$40, %al
	jne	.L21
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-12(%rbp), %eax
	leal	1(%rax), %ecx
	movq	-8(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	eval
	jmp	.L22
.L21:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	atoi@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	factor, .-factor
	.globl	find_open
	.type	find_open, @function
find_open:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$0, -8(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -4(%rbp)
	jmp	.L24
.L29:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$41, %al
	jne	.L25
	addl	$1, -8(%rbp)
.L25:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$40, %al
	jne	.L26
	cmpl	$0, -8(%rbp)
	jne	.L27
	movl	-4(%rbp), %eax
	jmp	.L28
.L27:
	subl	$1, -8(%rbp)
.L26:
	subl	$1, -4(%rbp)
.L24:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jge	.L29
	movl	$-1, %eax
.L28:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	find_open, .-find_open
	.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.
val
	.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	$160, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-152(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -148(%rbp)
	jmp	.L2
.L3:
	leaq	-144(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subl	$2, %eax
	movl	%eax, %edx
	leaq	-144(%rbp), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	eval
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -148(%rbp)
.L2:
	movl	-152(%rbp), %eax
	cmpl	%eax, -148(%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	eval
	.type	eval, @function
eval:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L7
.L12:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$41, %al
	jne	.L8
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	find_open
	subl	$1, %eax
	movl	%eax, -20(%rbp)
.L8:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$43, %al
	jne	.L9
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	eval
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
	addl	%ebx, %eax
	jmp	.L10
.L9:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$45, %al
	jne	.L11
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	eval
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
	movl	%eax, %edx
	movl	%ebx, %eax
	subl	%edx, %eax
	jmp	.L10
.L11:
	subl	$1, -20(%rbp)
.L7:
	movl	-20(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	.L12
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
.L10:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	eval, .-eval
	.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
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L14
.L19:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$41, %al
	jne	.L15
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	find_open
	subl	$1, %eax
	movl	%eax, -20(%rbp)
.L15:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$42, %al
	jne	.L16
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	factor
	imull	%ebx, %eax
	jmp	.L17
.L16:
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jne	.L18
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	term
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	factor
	movl	%eax, %esi
	movl	%ebx, %eax
	cltd
	idivl	%esi
	jmp	.L17
.L18:
	subl	$1, -20(%rbp)
.L14:
	movl	-20(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	.L19
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	factor
.L17:
	movq	-8(%rbp), %rbx
	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	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	%edx, -16(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$40, %al
	jne	.L21
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-12(%rbp), %eax
	leal	1(%rax), %ecx
	movq	-8(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	eval
	jmp	.L22
.L21:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	atoi@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	factor, .-factor
	.globl	find_open
	.type	find_open, @function
find_open:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$0, -8(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -4(%rbp)
	jmp	.L24
.L29:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$41, %al
	jne	.L25
	addl	$1, -8(%rbp)
.L25:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$40, %al
	jne	.L26
	cmpl	$0, -8(%rbp)
	jne	.L27
	movl	-4(%rbp), %eax
	jmp	.L28
.L27:
	subl	$1, -8(%rbp)
.L26:
	subl	$1, -4(%rbp)
.L24:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jge	.L29
	movl	$-1, %eax
.L28:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	find_open, .-find_open
	.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:
