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

```c
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
void push(int);
int pop();
 
int S_num[1000],top;
 
int main(){
  int num_a,num_b;
  char str_num[100];
 
  top=0;
 
  while(scanf("%s",str_num)!=EOF){
    if(str_num[0]=='+'){
      num_a=pop();
      num_b=pop();
      push(num_a+num_b);
    }else if(str_num[0]=='-'){
      num_b=pop();
      num_a=pop();
      push(num_a-num_b);
    }else if(str_num[0]=='*'){
      num_a=pop();
      num_b=pop();
      push(num_a*num_b);
    }else{
      push(atoi(str_num));
    }
  }
  
  printf("%d\n",pop());
 
  return 0;
}
 
void push(int x){
  top++;
  S_num[top]=x;
}
 
int pop(){
  top--;
  return S_num[top+1];
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	S_num(%rip), %rbx
	subq	$112, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movl	$0, top(%rip)
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L11
	movzbl	(%rsp), %eax
	cmpb	$43, %al
	je	.L12
	cmpb	$45, %al
	je	.L13
	cmpb	$42, %al
	jne	.L6
	movslq	top(%rip), %rax
	leal	-1(%rax), %esi
	movslq	%esi, %rcx
	movl	%esi, top(%rip)
	movl	(%rbx,%rcx,4), %edx
	imull	(%rbx,%rax,4), %edx
	movl	%edx, (%rbx,%rcx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	movslq	top(%rip), %rax
	leal	-1(%rax), %ecx
	movl	(%rbx,%rax,4), %eax
	movslq	%ecx, %rdx
	movl	%ecx, top(%rip)
	addl	%eax, (%rbx,%rdx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	movslq	top(%rip), %rax
	leal	-1(%rax), %esi
	movslq	%esi, %rcx
	movl	%esi, top(%rip)
	movl	(%rbx,%rcx,4), %edx
	subl	(%rbx,%rax,4), %edx
	movl	%edx, (%rbx,%rcx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$10, %edx
	xorl	%esi, %esi
	movq	%rbp, %rdi
	call	strtol@PLT
	movq	%rax, %r8
	movl	top(%rip), %eax
	addl	$1, %eax
	movl	%eax, top(%rip)
	cltq
	movl	%r8d, (%rbx,%rax,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	top(%rip), %rax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	leal	-1(%rax), %edx
	movl	%edx, top(%rip)
	movl	(%rbx,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$112, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.text
	.p2align 4
	.globl	push
	.type	push, @function
push:
.LFB52:
	.cfi_startproc
	endbr64
	movl	top(%rip), %eax
	leaq	S_num(%rip), %rdx
	addl	$1, %eax
	movl	%eax, top(%rip)
	cltq
	movl	%edi, (%rdx,%rax,4)
	ret
	.cfi_endproc
.LFE52:
	.size	push, .-push
	.p2align 4
	.globl	pop
	.type	pop, @function
pop:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	top(%rip), %rax
	leal	-1(%rax), %edx
	movl	%edx, top(%rip)
	leaq	S_num(%rip), %rdx
	movl	(%rdx,%rax,4), %eax
	ret
	.cfi_endproc
.LFE53:
	.size	pop, .-pop
	.globl	top
	.bss
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	S_num
	.align 32
	.type	S_num, @object
	.size	S_num, 4000
S_num:
	.zero	4000
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	S_num(%rip), %rbx
	subq	$112, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movl	$0, top(%rip)
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L11
	movzbl	(%rsp), %eax
	cmpb	$43, %al
	je	.L12
	cmpb	$45, %al
	je	.L13
	cmpb	$42, %al
	jne	.L6
	movslq	top(%rip), %rax
	leal	-1(%rax), %esi
	movslq	%esi, %rcx
	movl	%esi, top(%rip)
	movl	(%rbx,%rcx,4), %edx
	imull	(%rbx,%rax,4), %edx
	movl	%edx, (%rbx,%rcx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	movslq	top(%rip), %rax
	leal	-1(%rax), %ecx
	movl	(%rbx,%rax,4), %eax
	movslq	%ecx, %rdx
	movl	%ecx, top(%rip)
	addl	%eax, (%rbx,%rdx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	movslq	top(%rip), %rax
	leal	-1(%rax), %esi
	movslq	%esi, %rcx
	movl	%esi, top(%rip)
	movl	(%rbx,%rcx,4), %edx
	subl	(%rbx,%rax,4), %edx
	movl	%edx, (%rbx,%rcx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$10, %edx
	xorl	%esi, %esi
	movq	%rbp, %rdi
	call	strtol@PLT
	movq	%rax, %r8
	movl	top(%rip), %eax
	addl	$1, %eax
	movl	%eax, top(%rip)
	cltq
	movl	%r8d, (%rbx,%rax,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	top(%rip), %rax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	leal	-1(%rax), %edx
	movl	%edx, top(%rip)
	movl	(%rbx,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$112, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.text
	.p2align 4
	.globl	push
	.type	push, @function
push:
.LFB52:
	.cfi_startproc
	endbr64
	movl	top(%rip), %eax
	leaq	S_num(%rip), %rdx
	addl	$1, %eax
	movl	%eax, top(%rip)
	cltq
	movl	%edi, (%rdx,%rax,4)
	ret
	.cfi_endproc
.LFE52:
	.size	push, .-push
	.p2align 4
	.globl	pop
	.type	pop, @function
pop:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	top(%rip), %rax
	leal	-1(%rax), %edx
	movl	%edx, top(%rip)
	leaq	S_num(%rip), %rdx
	movl	(%rdx,%rax,4), %eax
	ret
	.cfi_endproc
.LFE53:
	.size	pop, .-pop
	.globl	top
	.bss
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	S_num
	.align 32
	.type	S_num, @object
	.size	S_num, 4000
S_num:
	.zero	4000
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	S_num(%rip), %rbx
	subq	$112, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movl	$0, top(%rip)
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L11
	movzbl	(%rsp), %eax
	cmpb	$43, %al
	je	.L12
	cmpb	$45, %al
	je	.L13
	cmpb	$42, %al
	jne	.L6
	movslq	top(%rip), %rax
	leal	-1(%rax), %esi
	movslq	%esi, %rcx
	movl	%esi, top(%rip)
	movl	(%rbx,%rcx,4), %edx
	imull	(%rbx,%rax,4), %edx
	movl	%edx, (%rbx,%rcx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	movslq	top(%rip), %rax
	leal	-1(%rax), %ecx
	movl	(%rbx,%rax,4), %eax
	movslq	%ecx, %rdx
	movl	%ecx, top(%rip)
	addl	%eax, (%rbx,%rdx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	movslq	top(%rip), %rax
	leal	-1(%rax), %esi
	movslq	%esi, %rcx
	movl	%esi, top(%rip)
	movl	(%rbx,%rcx,4), %edx
	subl	(%rbx,%rax,4), %edx
	movl	%edx, (%rbx,%rcx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$10, %edx
	xorl	%esi, %esi
	movq	%rbp, %rdi
	call	strtol@PLT
	movq	%rax, %r8
	movl	top(%rip), %eax
	addl	$1, %eax
	movl	%eax, top(%rip)
	cltq
	movl	%r8d, (%rbx,%rax,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	top(%rip), %rax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	leal	-1(%rax), %edx
	movl	%edx, top(%rip)
	movl	(%rbx,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$112, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.text
	.p2align 4
	.globl	push
	.type	push, @function
push:
.LFB52:
	.cfi_startproc
	endbr64
	movl	top(%rip), %eax
	leaq	S_num(%rip), %rdx
	addl	$1, %eax
	movl	%eax, top(%rip)
	cltq
	movl	%edi, (%rdx,%rax,4)
	ret
	.cfi_endproc
.LFE52:
	.size	push, .-push
	.p2align 4
	.globl	pop
	.type	pop, @function
pop:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	top(%rip), %rax
	leal	-1(%rax), %edx
	movl	%edx, top(%rip)
	leaq	S_num(%rip), %rdx
	movl	(%rdx,%rax,4), %eax
	ret
	.cfi_endproc
.LFE53:
	.size	pop, .-pop
	.globl	top
	.bss
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	S_num
	.align 32
	.type	S_num, @object
	.size	S_num, 4000
S_num:
	.zero	4000
	.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:
```
```c
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
void push(int);
int pop();
 
int S_num[1000],top;
 
int main(){
  int num_a,num_b;
  char str_num[100];
 
  top=0;
 
  while(scanf("%s",str_num)!=EOF){
    if(str_num[0]=='+'){
      num_a=pop();
      num_b=pop();
      push(num_a+num_b);
    }else if(str_num[0]=='-'){
      num_b=pop();
      num_a=pop();
      push(num_a-num_b);
    }else if(str_num[0]=='*'){
      num_a=pop();
      num_b=pop();
      push(num_a*num_b);
    }else{
      push(atoi(str_num));
    }
  }
  
  printf("%d\n",pop());
 
  return 0;
}
 
void push(int x){
  top++;
  S_num[top]=x;
}
 
int pop(){
  top--;
  return S_num[top+1];
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
void push(int);
int pop();
 
int S_num[1000],top;
 
int main(){
  int num_a,num_b;
  char str_num[100];
 
  top=0;
 
  while(scanf("%s",str_num)!=EOF){
    if(str_num[0]=='+'){
      num_a=pop();
      num_b=pop();
      push(num_a+num_b);
    }else if(str_num[0]=='-'){
      num_b=pop();
      num_a=pop();
      push(num_a-num_b);
    }else if(str_num[0]=='*'){
      num_a=pop();
      num_b=pop();
      push(num_a*num_b);
    }else{
      push(atoi(str_num));
    }
  }
  
  printf("%d\n",pop());
 
  return 0;
}
 
void push(int x){
  top++;
  S_num[top]=x;
}
 
int pop(){
  top--;
  return S_num[top+1];
}
```

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.
Optimized Assembly Code:

1 4 + 3 4 - *
 1 3 +
 1 4 + 2 4 - *
 0 3 +
 1 1 + 2 4 - *
 0 3 *
 1 4 + 3 8 - *
 0 5 +
 1 1 + 3 4 - *
 1 4 * 3 1 - *

-5
 4
 -10
 3
 -4
 0
 -25
 5
 -2
 8

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

```c
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
void push(int);
int pop();
 
int S_num[1000],top;
 
int main(){
  int num_a,num_b;
  char str_num[100];
 
  top=0;
 
  while(scanf("%s",str_num)!=EOF){
    if(str_num[0]=='+'){
      num_a=pop();
      num_b=pop();
      push(num_a+num_b);
    }else if(str_num[0]=='-'){
      num_b=pop();
      num_a=pop();
      push(num_a-num_b);
    }else if(str_num[0]=='*'){
      num_a=pop();
      num_b=pop();
      push(num_a*num_b);
    }else{
      push(atoi(str_num));
    }
  }
  
  printf("%d\n",pop());
 
  return 0;
}
 
void push(int x){
  top++;
  S_num[top]=x;
}
 
int pop(){
  top--;
  return S_num[top+1];
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	S_num(%rip), %rbx
	subq	$112, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movl	$0, top(%rip)
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L11
	movzbl	(%rsp), %eax
	cmpb	$43, %al
	je	.L12
	cmpb	$45, %al
	je	.L13
	cmpb	$42, %al
	jne	.L6
	movslq	top(%rip), %rax
	leal	-1(%rax), %esi
	movslq	%esi, %rcx
	movl	%esi, top(%rip)
	movl	(%rbx,%rcx,4), %edx
	imull	(%rbx,%rax,4), %edx
	movl	%edx, (%rbx,%rcx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	movslq	top(%rip), %rax
	leal	-1(%rax), %ecx
	movl	(%rbx,%rax,4), %eax
	movslq	%ecx, %rdx
	movl	%ecx, top(%rip)
	addl	%eax, (%rbx,%rdx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	movslq	top(%rip), %rax
	leal	-1(%rax), %esi
	movslq	%esi, %rcx
	movl	%esi, top(%rip)
	movl	(%rbx,%rcx,4), %edx
	subl	(%rbx,%rax,4), %edx
	movl	%edx, (%rbx,%rcx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$10, %edx
	xorl	%esi, %esi
	movq	%rbp, %rdi
	call	strtol@PLT
	movq	%rax, %r8
	movl	top(%rip), %eax
	addl	$1, %eax
	movl	%eax, top(%rip)
	cltq
	movl	%r8d, (%rbx,%rax,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	top(%rip), %rax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	leal	-1(%rax), %edx
	movl	%edx, top(%rip)
	movl	(%rbx,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$112, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.text
	.p2align 4
	.globl	push
	.type	push, @function
push:
.LFB52:
	.cfi_startproc
	endbr64
	movl	top(%rip), %eax
	leaq	S_num(%rip), %rdx
	addl	$1, %eax
	movl	%eax, top(%rip)
	cltq
	movl	%edi, (%rdx,%rax,4)
	ret
	.cfi_endproc
.LFE52:
	.size	push, .-push
	.p2align 4
	.globl	pop
	.type	pop, @function
pop:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	top(%rip), %rax
	leal	-1(%rax), %edx
	movl	%edx, top(%rip)
	leaq	S_num(%rip), %rdx
	movl	(%rdx,%rax,4), %eax
	ret
	.cfi_endproc
.LFE53:
	.size	pop, .-pop
	.globl	top
	.bss
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	S_num
	.align 32
	.type	S_num, @object
	.size	S_num, 4000
S_num:
	.zero	4000
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	S_num(%rip), %rbx
	subq	$112, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movl	$0, top(%rip)
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L11
	movzbl	(%rsp), %eax
	cmpb	$43, %al
	je	.L12
	cmpb	$45, %al
	je	.L13
	cmpb	$42, %al
	jne	.L6
	movslq	top(%rip), %rax
	leal	-1(%rax), %esi
	movslq	%esi, %rcx
	movl	%esi, top(%rip)
	movl	(%rbx,%rcx,4), %edx
	imull	(%rbx,%rax,4), %edx
	movl	%edx, (%rbx,%rcx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	movslq	top(%rip), %rax
	leal	-1(%rax), %ecx
	movl	(%rbx,%rax,4), %eax
	movslq	%ecx, %rdx
	movl	%ecx, top(%rip)
	addl	%eax, (%rbx,%rdx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	movslq	top(%rip), %rax
	leal	-1(%rax), %esi
	movslq	%esi, %rcx
	movl	%esi, top(%rip)
	movl	(%rbx,%rcx,4), %edx
	subl	(%rbx,%rax,4), %edx
	movl	%edx, (%rbx,%rcx,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$10, %edx
	xorl	%esi, %esi
	movq	%rbp, %rdi
	call	strtol@PLT
	movq	%rax, %r8
	movl	top(%rip), %eax
	addl	$1, %eax
	movl	%eax, top(%rip)
	cltq
	movl	%r8d, (%rbx,%rax,4)
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	top(%rip), %rax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	leal	-1(%rax), %edx
	movl	%edx, top(%rip)
	movl	(%rbx,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$112, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.text
	.p2align 4
	.globl	push
	.type	push, @function
push:
.LFB52:
	.cfi_startproc
	endbr64
	movl	top(%rip), %eax
	leaq	S_num(%rip), %rdx
	addl	$1, %eax
	movl	%eax, top(%rip)
	cltq
	movl	%edi, (%rdx,%rax,4)
	ret
	.cfi_endproc
.LFE52:
	.size	push, .-push
	.p2align 4
	.globl	pop
	.type	pop, @function
pop:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	top(%rip), %rax
	leal	-1(%rax), %edx
	movl	%edx, top(%rip)
	leaq	S_num(%rip), %rdx
	movl	(%rdx,%rax,4), %eax
	ret
	.cfi_endproc
.LFE53:
	.size	pop, .-pop
	.globl	top
	.bss
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	S_num
	.align 32
	.type	S_num, @object
	.size	S_num, 4000
S_num:
	.zero	4000
	.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:
```