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>
long long MIN(long long a,long long b){return a<b?a:b;}
long long MAX(long long a,long long b){return a<b?b:a;}
long long n,m,i,j,k,a[100010],b[100010],c[100010],min,d[2][100010];
int main(){
	char s[100010][10];
	while(scanf("%d",&n),n){
		for(i=0;i<n;i++)scanf("%lld",&a[i]);
		scanf("%d",&m);
		for(i=0;i<m;i++)scanf("%*s %lld %s %lld",&b[i],&s[i],&c[i]);
		for(i=0;i<100010;i++)d[0][i]=d[1][i]=1e9+10;
		for(i=d[0][0]=d[1][0]=0;i<100000;i++){
			for(j=0;j<m;j++){
				k=(s[j][0]=='S'?0:1);
				d[k][MIN(100000,i+c[j])]=MIN(d[k][MIN(100000,i+c[j])],d[k][i]+b[j]);
			}
		}//return 0;
		for(i=0;i<2;i++){
			for(j=100000;j;j--)d[i][j-1]=MIN(d[i][j-1],d[i][j]);
		}
		min=1e9+10;
		for(i=0;i<100001;i++){
			k=d[1][i];
			for(j=0;j<n;j++)k+=d[0][MAX(0,a[j]-i)];
			min=MIN(min,k);
		}
		printf("%lld\n",min);
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	MIN, .-MIN
	.globl	MAX
	.type	MAX, @function
MAX:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	MAX, .-MAX
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	i
	.align 8
	.type	i, @object
	.size	i, 8
i:
	.zero	8
	.globl	j
	.align 8
	.type	j, @object
	.size	j, 8
j:
	.zero	8
	.globl	k
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800080
a:
	.zero	800080
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800080
b:
	.zero	800080
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 800080
c:
	.zero	800080
	.globl	min
	.align 8
	.type	min, @object
	.size	min, 8
min:
	.zero	8
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 1600160
d:
	.zero	1600160
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%d"
.LC2:
	.string	"%*s %lld %s %lld"
.LC3:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$688, %rsp
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	jmp	.L6
.L25:
	movq	$0, i(%rip)
	jmp	.L7
.L8:
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L7:
	movq	i(%rip), %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L8
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, i(%rip)
	jmp	.L9
.L10:
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movq	i(%rip), %rdx
	leaq	-1000144(%rbp), %rsi
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rsi,%rax), %rdx
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rsi
	leaq	b(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L9:
	movq	i(%rip), %rdx
	movq	m(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L10
	movq	$0, i(%rip)
	jmp	.L11
.L12:
	movq	i(%rip), %rax
	leaq	100010(%rax), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	$1000000010, (%rcx,%rdx)
	movq	i(%rip), %rdx
	addq	$100010, %rax
	leaq	0(,%rax,8), %rcx
	leaq	d(%rip), %rax
	movq	(%rcx,%rax), %rax
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L11:
	movq	i(%rip), %rax
	cmpq	$100009, %rax
	jle	.L12
	movq	$0, 800080+d(%rip)
	movq	800080+d(%rip), %rax
	movq	%rax, d(%rip)
	movq	d(%rip), %rax
	movq	%rax, i(%rip)
	jmp	.L13
.L16:
	movq	$0, j(%rip)
	jmp	.L14
.L15:
	movq	j(%rip), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	-32(%rax), %rax
	addq	%rbp, %rax
	subq	$1000112, %rax
	movzbl	(%rax), %eax
	cmpb	$83, %al
	setne	%al
	movzbl	%al, %eax
	movq	%rax, k(%rip)
	movq	k(%rip), %rax
	movq	i(%rip), %rdx
	imulq	$100010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movq	j(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rcx,%rax), %r12
	movq	k(%rip), %rbx
	movq	j(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	i(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	movl	$100000, %edi
	call	MIN
	imulq	$100010, %rbx, %rdx
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rbx
	movq	k(%rip), %r13
	movq	j(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	i(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	movl	$100000, %edi
	call	MIN
	movq	%rax, %r14
	movq	%r12, %rsi
	movq	%rbx, %rdi
	call	MIN
	imulq	$100010, %r13, %rdx
	addq	%r14, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	j(%rip), %rax
	addq	$1, %rax
	movq	%rax, j(%rip)
.L14:
	movq	j(%rip), %rdx
	movq	m(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L15
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L13:
	movq	i(%rip), %rax
	cmpq	$99999, %rax
	jle	.L16
	movq	$0, i(%rip)
	jmp	.L17
.L20:
	movq	$100000, j(%rip)
	jmp	.L18
.L19:
	movq	i(%rip), %rax
	movq	j(%rip), %rdx
	imulq	$100010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	i(%rip), %rax
	movq	j(%rip), %rcx
	subq	$1, %rcx
	imulq	$100010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rcx
	leaq	d(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	i(%rip), %rbx
	movq	j(%rip), %rcx
	leaq	-1(%rcx), %r12
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	MIN
	imulq	$100010, %rbx, %rdx
	addq	%r12, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	j(%rip), %rax
	subq	$1, %rax
	movq	%rax, j(%rip)
.L18:
	movq	j(%rip), %rax
	testq	%rax, %rax
	jne	.L19
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L17:
	movq	i(%rip), %rax
	cmpq	$1, %rax
	jle	.L20
	movq	$1000000010, min(%rip)
	movq	$0, i(%rip)
	jmp	.L21
.L24:
	movq	i(%rip), %rax
	addq	$100010, %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, k(%rip)
	movq	$0, j(%rip)
	jmp	.L22
.L23:
	movq	j(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	i(%rip), %rdx
	subq	%rdx, %rax
	movq	%rax, %rsi
	movl	$0, %edi
	call	MAX
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	k(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, k(%rip)
	movq	j(%rip), %rax
	addq	$1, %rax
	movq	%rax, j(%rip)
.L22:
	movq	j(%rip), %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L23
	movq	k(%rip), %rdx
	movq	min(%rip), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	MIN
	movq	%rax, min(%rip)
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L21:
	movq	i(%rip), %rax
	cmpq	$100000, %rax
	jle	.L24
	movq	min(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L6:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rax
	testq	%rax, %rax
	jne	.L25
	movl	$0, %eax
	movq	-40(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	addq	$1000112, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB23:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	movq	%rdi, %rax
	cmovle	%rsi, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	MIN, .-MIN
	.p2align 4
	.globl	MAX
	.type	MAX, @function
MAX:
.LFB24:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	movq	%rsi, %rax
	cmovge	%rdi, %rax
	ret
	.cfi_endproc
.LFE24:
	.size	MAX, .-MAX
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%*s %lld %s %lld"
.LC4:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-999424(%rsp), %r11
	.cfi_def_cfa 11, 999480
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$696, %rsp
	.cfi_def_cfa_offset 1000176
	leaq	.LC0(%rip), %rbp
	leaq	a(%rip), %rbx
	leaq	c(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 1000104(%rsp)
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L5:
	xorl	%eax, %eax
	leaq	n(%rip), %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpq	$0, n(%rip)
	je	.L36
	movq	$0, i(%rip)
	movl	$0, %eax
	leaq	.LC1(%rip), %r13
	jle	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	(%rbx,%rax,8), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	cmpq	n(%rip), %rax
	movq	%rax, i(%rip)
	jl	.L6
.L9:
	leaq	m(%rip), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movq	%rsp, %r15
	call	__isoc99_scanf@PLT
	movq	m(%rip), %r9
	xorl	%eax, %eax
	movq	$0, i(%rip)
	leaq	b(%rip), %r14
	leaq	.LC2(%rip), %r13
	testq	%r9, %r9
	jle	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	0(,%rax,8), %rsi
	leaq	(%rax,%rax,4), %rax
	movq	%r13, %rdi
	leaq	(%r12,%rsi), %rcx
	leaq	(%r15,%rax,2), %rdx
	addq	%r14, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	i(%rip), %rax
	movq	m(%rip), %r9
	addq	$1, %rax
	movq	%rax, i(%rip)
	cmpq	%r9, %rax
	jl	.L7
.L8:
	leaq	d(%rip), %r13
	leaq	800080(%r13), %r11
	movq	%r13, %rsi
	movq	%r13, %rax
	.p2align 4,,10
	.p2align 3
.L10:
	movdqa	.LC3(%rip), %xmm1
	addq	$16, %rax
	movaps	%xmm1, 800064(%rax)
	movaps	%xmm1, -16(%rax)
	cmpq	%rax, %r11
	jne	.L10
	xorl	%r8d, %r8d
	movq	%rsp, %r14
	leaq	b(%rip), %r10
	movq	$0, 800080+d(%rip)
	movq	$0, d(%rip)
	.p2align 4,,10
	.p2align 3
.L13:
	testq	%r9, %r9
	jle	.L11
	movq	%r14, %rdi
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L12:
	movq	(%r12,%rcx,8), %rax
	xorl	%edx, %edx
	cmpb	$83, (%rdi)
	movl	$100000, %r15d
	setne	%dl
	addq	%r8, %rax
	cmpq	%r15, %rax
	cmovg	%r15, %rax
	imulq	$100010, %rdx, %rdx
	addq	%rdx, %rax
	leaq	(%rdx,%r8), %r15
	movq	(%r10,%rcx,8), %rdx
	addq	(%rsi,%r15,8), %rdx
	movq	(%rsi,%rax,8), %r15
	cmpq	%r15, %rdx
	cmovg	%r15, %rdx
	addq	$1, %rcx
	addq	$10, %rdi
	movq	%rdx, (%rsi,%rax,8)
	cmpq	%rcx, %r9
	jne	.L12
.L11:
	addq	$1, %r8
	cmpq	$100000, %r8
	jne	.L13
	movq	799992+d(%rip), %rdx
	movq	800000+d(%rip), %rax
	movq	1600080+d(%rip), %rcx
	cmpq	%rax, %rdx
	cmovg	%rax, %rdx
	movq	1600072+d(%rip), %rax
	cmpq	%rcx, %rax
	movq	%rdx, %xmm3
	cmovg	%rcx, %rax
	movq	799984+d(%rip), %rcx
	cmpq	%rcx, %rdx
	movq	%rax, %xmm4
	cmovle	%rdx, %rcx
	movq	1600064+d(%rip), %rdx
	cmpq	%rdx, %rax
	movq	%rcx, %xmm0
	leaq	-799984+d(%rip), %rcx
	cmovle	%rax, %rdx
	punpcklqdq	%xmm3, %xmm0
	movaps	%xmm0, 799984+d(%rip)
	movq	%rdx, %xmm0
	punpcklqdq	%xmm4, %xmm0
	movaps	%xmm0, 1600064+d(%rip)
.L14:
	movq	799976(%r13), %rax
	movq	799984(%r13), %rdx
	cmpq	%rdx, %rax
	cmovg	%rdx, %rax
	movq	1600064(%r13), %rdx
	movq	%rax, 799976(%r13)
	movq	1600056(%r13), %rax
	cmpq	%rdx, %rax
	cmovg	%rdx, %rax
	subq	$8, %r13
	movq	%rax, 1600064(%r13)
	cmpq	%r13, %rcx
	jne	.L14
	movq	n(%rip), %r13
	xorl	%r8d, %r8d
	movl	$1000000010, %r10d
	leaq	(%rbx,%r13,8), %r9
	.p2align 4,,10
	.p2align 3
.L17:
	movq	(%r11,%r8,8), %rcx
	testq	%r13, %r13
	jle	.L22
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L16:
	movq	(%rdx), %rax
	movl	$0, %edi
	subq	%r8, %rax
	cmovs	%rdi, %rax
	addq	$8, %rdx
	addq	(%rsi,%rax,8), %rcx
	cmpq	%r9, %rdx
	jne	.L16
	movq	%r13, %rax
.L15:
	cmpq	%rcx, %r10
	cmovg	%rcx, %r10
	addq	$1, %r8
	cmpq	$100001, %r8
	jne	.L17
	movq	%rax, j(%rip)
	movq	%r10, %rdx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC4(%rip), %rsi
	movq	%rcx, k(%rip)
	movq	%r10, min(%rip)
	movq	$100001, i(%rip)
	call	__printf_chk@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L22:
	xorl	%eax, %eax
	jmp	.L15
.L36:
	movq	1000104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$1000120, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L37:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 1600160
d:
	.zero	1600160
	.globl	min
	.align 8
	.type	min, @object
	.size	min, 8
min:
	.zero	8
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 800080
c:
	.zero	800080
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800080
b:
	.zero	800080
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800080
a:
	.zero	800080
	.globl	k
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.zero	8
	.globl	j
	.align 8
	.type	j, @object
	.size	j, 8
j:
	.zero	8
	.globl	i
	.align 8
	.type	i, @object
	.size	i, 8
i:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC3:
	.quad	1000000010
	.quad	1000000010
	.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	MIN
	.type	MIN, @function
MIN:
.LFB23:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	movq	%rdi, %rax
	cmovle	%rsi, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	MIN, .-MIN
	.p2align 4
	.globl	MAX
	.type	MAX, @function
MAX:
.LFB24:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	movq	%rsi, %rax
	cmovge	%rdi, %rax
	ret
	.cfi_endproc
.LFE24:
	.size	MAX, .-MAX
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%*s %lld %s %lld"
.LC4:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-999424(%rsp), %r11
	.cfi_def_cfa 11, 999480
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$696, %rsp
	.cfi_def_cfa_offset 1000176
	leaq	.LC0(%rip), %rbp
	leaq	a(%rip), %rbx
	leaq	c(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 1000104(%rsp)
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L5:
	xorl	%eax, %eax
	leaq	n(%rip), %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpq	$0, n(%rip)
	je	.L36
	movq	$0, i(%rip)
	movl	$0, %eax
	leaq	.LC1(%rip), %r13
	jle	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	(%rbx,%rax,8), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	cmpq	n(%rip), %rax
	movq	%rax, i(%rip)
	jl	.L6
.L9:
	leaq	m(%rip), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movq	%rsp, %r15
	call	__isoc99_scanf@PLT
	movq	m(%rip), %r9
	xorl	%eax, %eax
	movq	$0, i(%rip)
	leaq	b(%rip), %r14
	leaq	.LC2(%rip), %r13
	testq	%r9, %r9
	jle	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	0(,%rax,8), %rsi
	leaq	(%rax,%rax,4), %rax
	movq	%r13, %rdi
	leaq	(%r12,%rsi), %rcx
	leaq	(%r15,%rax,2), %rdx
	addq	%r14, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	i(%rip), %rax
	movq	m(%rip), %r9
	addq	$1, %rax
	movq	%rax, i(%rip)
	cmpq	%r9, %rax
	jl	.L7
.L8:
	leaq	d(%rip), %r13
	leaq	800080(%r13), %r11
	movq	%r13, %rsi
	movq	%r13, %rax
	.p2align 4,,10
	.p2align 3
.L10:
	movdqa	.LC3(%rip), %xmm1
	addq	$16, %rax
	movaps	%xmm1, 800064(%rax)
	movaps	%xmm1, -16(%rax)
	cmpq	%rax, %r11
	jne	.L10
	xorl	%r8d, %r8d
	movq	%rsp, %r14
	leaq	b(%rip), %r10
	movq	$0, 800080+d(%rip)
	movq	$0, d(%rip)
	.p2align 4,,10
	.p2align 3
.L13:
	testq	%r9, %r9
	jle	.L11
	movq	%r14, %rdi
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L12:
	movq	(%r12,%rcx,8), %rax
	xorl	%edx, %edx
	cmpb	$83, (%rdi)
	movl	$100000, %r15d
	setne	%dl
	addq	%r8, %rax
	cmpq	%r15, %rax
	cmovg	%r15, %rax
	imulq	$100010, %rdx, %rdx
	addq	%rdx, %rax
	leaq	(%rdx,%r8), %r15
	movq	(%r10,%rcx,8), %rdx
	addq	(%rsi,%r15,8), %rdx
	movq	(%rsi,%rax,8), %r15
	cmpq	%r15, %rdx
	cmovg	%r15, %rdx
	addq	$1, %rcx
	addq	$10, %rdi
	movq	%rdx, (%rsi,%rax,8)
	cmpq	%rcx, %r9
	jne	.L12
.L11:
	addq	$1, %r8
	cmpq	$100000, %r8
	jne	.L13
	movq	799992+d(%rip), %rdx
	movq	800000+d(%rip), %rax
	movq	1600080+d(%rip), %rcx
	cmpq	%rax, %rdx
	cmovg	%rax, %rdx
	movq	1600072+d(%rip), %rax
	cmpq	%rcx, %rax
	movq	%rdx, %xmm3
	cmovg	%rcx, %rax
	movq	799984+d(%rip), %rcx
	cmpq	%rcx, %rdx
	movq	%rax, %xmm4
	cmovle	%rdx, %rcx
	movq	1600064+d(%rip), %rdx
	cmpq	%rdx, %rax
	movq	%rcx, %xmm0
	leaq	-799984+d(%rip), %rcx
	cmovle	%rax, %rdx
	punpcklqdq	%xmm3, %xmm0
	movaps	%xmm0, 799984+d(%rip)
	movq	%rdx, %xmm0
	punpcklqdq	%xmm4, %xmm0
	movaps	%xmm0, 1600064+d(%rip)
.L14:
	movq	799976(%r13), %rax
	movq	799984(%r13), %rdx
	cmpq	%rdx, %rax
	cmovg	%rdx, %rax
	movq	1600064(%r13), %rdx
	movq	%rax, 799976(%r13)
	movq	1600056(%r13), %rax
	cmpq	%rdx, %rax
	cmovg	%rdx, %rax
	subq	$8, %r13
	movq	%rax, 1600064(%r13)
	cmpq	%r13, %rcx
	jne	.L14
	movq	n(%rip), %r13
	xorl	%r8d, %r8d
	movl	$1000000010, %r10d
	leaq	(%rbx,%r13,8), %r9
	.p2align 4,,10
	.p2align 3
.L17:
	movq	(%r11,%r8,8), %rcx
	testq	%r13, %r13
	jle	.L22
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L16:
	movq	(%rdx), %rax
	movl	$0, %edi
	subq	%r8, %rax
	cmovs	%rdi, %rax
	addq	$8, %rdx
	addq	(%rsi,%rax,8), %rcx
	cmpq	%r9, %rdx
	jne	.L16
	movq	%r13, %rax
.L15:
	cmpq	%rcx, %r10
	cmovg	%rcx, %r10
	addq	$1, %r8
	cmpq	$100001, %r8
	jne	.L17
	movq	%rax, j(%rip)
	movq	%r10, %rdx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC4(%rip), %rsi
	movq	%rcx, k(%rip)
	movq	%r10, min(%rip)
	movq	$100001, i(%rip)
	call	__printf_chk@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L22:
	xorl	%eax, %eax
	jmp	.L15
.L36:
	movq	1000104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$1000120, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L37:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 1600160
d:
	.zero	1600160
	.globl	min
	.align 8
	.type	min, @object
	.size	min, 8
min:
	.zero	8
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 800080
c:
	.zero	800080
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800080
b:
	.zero	800080
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800080
a:
	.zero	800080
	.globl	k
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.zero	8
	.globl	j
	.align 8
	.type	j, @object
	.size	j, 8
j:
	.zero	8
	.globl	i
	.align 8
	.type	i, @object
	.size	i, 8
i:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC3:
	.quad	1000000010
	.quad	1000000010
	.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>
long long MIN(long long a,long long b){return a<b?a:b;}
long long MAX(long long a,long long b){return a<b?b:a;}
long long n,m,i,j,k,a[100010],b[100010],c[100010],min,d[2][100010];
int main(){
	char s[100010][10];
	while(scanf("%d",&n),n){
		for(i=0;i<n;i++)scanf("%lld",&a[i]);
		scanf("%d",&m);
		for(i=0;i<m;i++)scanf("%*s %lld %s %lld",&b[i],&s[i],&c[i]);
		for(i=0;i<100010;i++)d[0][i]=d[1][i]=1e9+10;
		for(i=d[0][0]=d[1][0]=0;i<100000;i++){
			for(j=0;j<m;j++){
				k=(s[j][0]=='S'?0:1);
				d[k][MIN(100000,i+c[j])]=MIN(d[k][MIN(100000,i+c[j])],d[k][i]+b[j]);
			}
		}//return 0;
		for(i=0;i<2;i++){
			for(j=100000;j;j--)d[i][j-1]=MIN(d[i][j-1],d[i][j]);
		}
		min=1e9+10;
		for(i=0;i<100001;i++){
			k=d[1][i];
			for(j=0;j<n;j++)k+=d[0][MAX(0,a[j]-i)];
			min=MIN(min,k);
		}
		printf("%lld\n",min);
	}
	return 0;
}

3
8000 15000 30000
3
Flare 45 Single 5272
Meteor 62 All 6000
Ultimate 80 All 9999
0
 3
8000 15000 30000
3
Flare 45 elgniS 5272
Meteor 62 Bll 6000
Ultimate 80 All 13247
0
 3
8000 15000 37775
3
Flare 45 Single 8000
Meteor 62 All 6000
Ultimate 80 All 9999
0
 3
8000 22827 30000
3
Flare 45 Single 5272
Meteor 62 All 6000
Ultimate 80 All 9999
0
 3
8000 15000 30000
3
Flare 45 elgniS 5272
Meteor 62 All 10787
Ultimate 80 All 9999
0
 3
8000 15000 30000
3
lFare 45 Single 5272
Meteor 62 All 6000
Ultimate 112 All 9999
0
 3
8000 3283 37775
3
Flare 45 Single 8000
Meteor 62 All 6000
Ultimate 80 All 9999
0
 3
1455 15000 41590
3
Flare 45 elhniS 5272
Meteor 91 Bll 5099
Ultimate 80 All 13247
0
 3
1455 15000 41590
3
Flare 45 elhniS 5272
Meteor 91 Bll 5099
Ultimate 80 All 24954
0
 3
8000 15000 30000
3
Flare 45 Single 8000
Meteos 62 All 6000
Ultimate 80 All 9999
0

250
 205
 277
 267
 186
 309
 260
 285
 160
 232

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>
long long MIN(long long a,long long b){return a<b?a:b;}
long long MAX(long long a,long long b){return a<b?b:a;}
long long n,m,i,j,k,a[100010],b[100010],c[100010],min,d[2][100010];
int main(){
	char s[100010][10];
	while(scanf("%d",&n),n){
		for(i=0;i<n;i++)scanf("%lld",&a[i]);
		scanf("%d",&m);
		for(i=0;i<m;i++)scanf("%*s %lld %s %lld",&b[i],&s[i],&c[i]);
		for(i=0;i<100010;i++)d[0][i]=d[1][i]=1e9+10;
		for(i=d[0][0]=d[1][0]=0;i<100000;i++){
			for(j=0;j<m;j++){
				k=(s[j][0]=='S'?0:1);
				d[k][MIN(100000,i+c[j])]=MIN(d[k][MIN(100000,i+c[j])],d[k][i]+b[j]);
			}
		}//return 0;
		for(i=0;i<2;i++){
			for(j=100000;j;j--)d[i][j-1]=MIN(d[i][j-1],d[i][j]);
		}
		min=1e9+10;
		for(i=0;i<100001;i++){
			k=d[1][i];
			for(j=0;j<n;j++)k+=d[0][MAX(0,a[j]-i)];
			min=MIN(min,k);
		}
		printf("%lld\n",min);
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	MIN, .-MIN
	.globl	MAX
	.type	MAX, @function
MAX:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	MAX, .-MAX
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	i
	.align 8
	.type	i, @object
	.size	i, 8
i:
	.zero	8
	.globl	j
	.align 8
	.type	j, @object
	.size	j, 8
j:
	.zero	8
	.globl	k
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800080
a:
	.zero	800080
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800080
b:
	.zero	800080
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 800080
c:
	.zero	800080
	.globl	min
	.align 8
	.type	min, @object
	.size	min, 8
min:
	.zero	8
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 1600160
d:
	.zero	1600160
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%d"
.LC2:
	.string	"%*s %lld %s %lld"
.LC3:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$688, %rsp
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	jmp	.L6
.L25:
	movq	$0, i(%rip)
	jmp	.L7
.L8:
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L7:
	movq	i(%rip), %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L8
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, i(%rip)
	jmp	.L9
.L10:
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movq	i(%rip), %rdx
	leaq	-1000144(%rbp), %rsi
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rsi,%rax), %rdx
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rsi
	leaq	b(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L9:
	movq	i(%rip), %rdx
	movq	m(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L10
	movq	$0, i(%rip)
	jmp	.L11
.L12:
	movq	i(%rip), %rax
	leaq	100010(%rax), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	$1000000010, (%rcx,%rdx)
	movq	i(%rip), %rdx
	addq	$100010, %rax
	leaq	0(,%rax,8), %rcx
	leaq	d(%rip), %rax
	movq	(%rcx,%rax), %rax
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L11:
	movq	i(%rip), %rax
	cmpq	$100009, %rax
	jle	.L12
	movq	$0, 800080+d(%rip)
	movq	800080+d(%rip), %rax
	movq	%rax, d(%rip)
	movq	d(%rip), %rax
	movq	%rax, i(%rip)
	jmp	.L13
.L16:
	movq	$0, j(%rip)
	jmp	.L14
.L15:
	movq	j(%rip), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	-32(%rax), %rax
	addq	%rbp, %rax
	subq	$1000112, %rax
	movzbl	(%rax), %eax
	cmpb	$83, %al
	setne	%al
	movzbl	%al, %eax
	movq	%rax, k(%rip)
	movq	k(%rip), %rax
	movq	i(%rip), %rdx
	imulq	$100010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movq	j(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rcx,%rax), %r12
	movq	k(%rip), %rbx
	movq	j(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	i(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	movl	$100000, %edi
	call	MIN
	imulq	$100010, %rbx, %rdx
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rbx
	movq	k(%rip), %r13
	movq	j(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	i(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	movl	$100000, %edi
	call	MIN
	movq	%rax, %r14
	movq	%r12, %rsi
	movq	%rbx, %rdi
	call	MIN
	imulq	$100010, %r13, %rdx
	addq	%r14, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	j(%rip), %rax
	addq	$1, %rax
	movq	%rax, j(%rip)
.L14:
	movq	j(%rip), %rdx
	movq	m(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L15
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L13:
	movq	i(%rip), %rax
	cmpq	$99999, %rax
	jle	.L16
	movq	$0, i(%rip)
	jmp	.L17
.L20:
	movq	$100000, j(%rip)
	jmp	.L18
.L19:
	movq	i(%rip), %rax
	movq	j(%rip), %rdx
	imulq	$100010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	i(%rip), %rax
	movq	j(%rip), %rcx
	subq	$1, %rcx
	imulq	$100010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rcx
	leaq	d(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	i(%rip), %rbx
	movq	j(%rip), %rcx
	leaq	-1(%rcx), %r12
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	MIN
	imulq	$100010, %rbx, %rdx
	addq	%r12, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	j(%rip), %rax
	subq	$1, %rax
	movq	%rax, j(%rip)
.L18:
	movq	j(%rip), %rax
	testq	%rax, %rax
	jne	.L19
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L17:
	movq	i(%rip), %rax
	cmpq	$1, %rax
	jle	.L20
	movq	$1000000010, min(%rip)
	movq	$0, i(%rip)
	jmp	.L21
.L24:
	movq	i(%rip), %rax
	addq	$100010, %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, k(%rip)
	movq	$0, j(%rip)
	jmp	.L22
.L23:
	movq	j(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	i(%rip), %rdx
	subq	%rdx, %rax
	movq	%rax, %rsi
	movl	$0, %edi
	call	MAX
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	k(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, k(%rip)
	movq	j(%rip), %rax
	addq	$1, %rax
	movq	%rax, j(%rip)
.L22:
	movq	j(%rip), %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L23
	movq	k(%rip), %rdx
	movq	min(%rip), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	MIN
	movq	%rax, min(%rip)
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L21:
	movq	i(%rip), %rax
	cmpq	$100000, %rax
	jle	.L24
	movq	min(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L6:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rax
	testq	%rax, %rax
	jne	.L25
	movl	$0, %eax
	movq	-40(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	addq	$1000112, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	MIN, .-MIN
	.globl	MAX
	.type	MAX, @function
MAX:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	MAX, .-MAX
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	i
	.align 8
	.type	i, @object
	.size	i, 8
i:
	.zero	8
	.globl	j
	.align 8
	.type	j, @object
	.size	j, 8
j:
	.zero	8
	.globl	k
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800080
a:
	.zero	800080
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800080
b:
	.zero	800080
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 800080
c:
	.zero	800080
	.globl	min
	.align 8
	.type	min, @object
	.size	min, 8
min:
	.zero	8
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 1600160
d:
	.zero	1600160
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%d"
.LC2:
	.string	"%*s %lld %s %lld"
.LC3:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$688, %rsp
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	jmp	.L6
.L25:
	movq	$0, i(%rip)
	jmp	.L7
.L8:
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L7:
	movq	i(%rip), %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L8
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, i(%rip)
	jmp	.L9
.L10:
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movq	i(%rip), %rdx
	leaq	-1000144(%rbp), %rsi
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rsi,%rax), %rdx
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rsi
	leaq	b(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L9:
	movq	i(%rip), %rdx
	movq	m(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L10
	movq	$0, i(%rip)
	jmp	.L11
.L12:
	movq	i(%rip), %rax
	leaq	100010(%rax), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	$1000000010, (%rcx,%rdx)
	movq	i(%rip), %rdx
	addq	$100010, %rax
	leaq	0(,%rax,8), %rcx
	leaq	d(%rip), %rax
	movq	(%rcx,%rax), %rax
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L11:
	movq	i(%rip), %rax
	cmpq	$100009, %rax
	jle	.L12
	movq	$0, 800080+d(%rip)
	movq	800080+d(%rip), %rax
	movq	%rax, d(%rip)
	movq	d(%rip), %rax
	movq	%rax, i(%rip)
	jmp	.L13
.L16:
	movq	$0, j(%rip)
	jmp	.L14
.L15:
	movq	j(%rip), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	-32(%rax), %rax
	addq	%rbp, %rax
	subq	$1000112, %rax
	movzbl	(%rax), %eax
	cmpb	$83, %al
	setne	%al
	movzbl	%al, %eax
	movq	%rax, k(%rip)
	movq	k(%rip), %rax
	movq	i(%rip), %rdx
	imulq	$100010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movq	j(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rcx,%rax), %r12
	movq	k(%rip), %rbx
	movq	j(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	i(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	movl	$100000, %edi
	call	MIN
	imulq	$100010, %rbx, %rdx
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rbx
	movq	k(%rip), %r13
	movq	j(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	i(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	movl	$100000, %edi
	call	MIN
	movq	%rax, %r14
	movq	%r12, %rsi
	movq	%rbx, %rdi
	call	MIN
	imulq	$100010, %r13, %rdx
	addq	%r14, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	j(%rip), %rax
	addq	$1, %rax
	movq	%rax, j(%rip)
.L14:
	movq	j(%rip), %rdx
	movq	m(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L15
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L13:
	movq	i(%rip), %rax
	cmpq	$99999, %rax
	jle	.L16
	movq	$0, i(%rip)
	jmp	.L17
.L20:
	movq	$100000, j(%rip)
	jmp	.L18
.L19:
	movq	i(%rip), %rax
	movq	j(%rip), %rdx
	imulq	$100010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	i(%rip), %rax
	movq	j(%rip), %rcx
	subq	$1, %rcx
	imulq	$100010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rcx
	leaq	d(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	i(%rip), %rbx
	movq	j(%rip), %rcx
	leaq	-1(%rcx), %r12
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	MIN
	imulq	$100010, %rbx, %rdx
	addq	%r12, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	j(%rip), %rax
	subq	$1, %rax
	movq	%rax, j(%rip)
.L18:
	movq	j(%rip), %rax
	testq	%rax, %rax
	jne	.L19
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L17:
	movq	i(%rip), %rax
	cmpq	$1, %rax
	jle	.L20
	movq	$1000000010, min(%rip)
	movq	$0, i(%rip)
	jmp	.L21
.L24:
	movq	i(%rip), %rax
	addq	$100010, %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, k(%rip)
	movq	$0, j(%rip)
	jmp	.L22
.L23:
	movq	j(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	i(%rip), %rdx
	subq	%rdx, %rax
	movq	%rax, %rsi
	movl	$0, %edi
	call	MAX
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	k(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, k(%rip)
	movq	j(%rip), %rax
	addq	$1, %rax
	movq	%rax, j(%rip)
.L22:
	movq	j(%rip), %rdx
	movq	n(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L23
	movq	k(%rip), %rdx
	movq	min(%rip), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	MIN
	movq	%rax, min(%rip)
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L21:
	movq	i(%rip), %rax
	cmpq	$100000, %rax
	jle	.L24
	movq	min(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L6:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rax
	testq	%rax, %rax
	jne	.L25
	movl	$0, %eax
	movq	-40(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	addq	$1000112, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
