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

```c
#include <stdio.h>

int max(int W,int R)
{
  return (W >= R) ? W : R;
}

int array_min(int array[],int e)
{
  int min = array[0];
  
  for(int i=1; i<e; i++)
    if(min > array[i])
      min = array[i];
  
  return min;
}

int main(void)
{
  int n;
  int left_w = 0,right_r=0;
  
  scanf("%d",&n);
  char c[n];
  int maxs[n+1];
  scanf("%s",c);
  
  for(int i=0; i<n; i++){
    if(c[i] == 'R')
      right_r++;
  }
  
  maxs[0] = max(left_w,right_r);
    
  for(int i=0; i<n; i++){
    if(c[i] == 'W')
      left_w++;
    else
      right_r--;
    
    maxs[i+1] = max(left_w,right_r);
  }
  
  printf("%d\n",array_min(maxs,n+1));
  
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.globl	array_min
	.type	array_min, @function
array_min:
.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, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L4
.L6:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L5
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
.L5:
	addl	$1, -4(%rbp)
.L4:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L6
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	array_min, .-array_min
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\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	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	subq	$112, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %r12
	movl	$0, -88(%rbp)
	movl	$0, -84(%rbp)
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-92(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -112(%rbp)
	movq	$0, -104(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -128(%rbp)
	movq	$0, -120(%rbp)
	cltq
	movl	$16, %edx
	subq	$1, %rdx
	addq	%rdx, %rax
	movl	$16, %ebx
	movl	$0, %edx
	divq	%rbx
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movl	-92(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -56(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %ebx
	movl	$0, %edx
	divq	%rbx
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L12:
	cmpq	%rdx, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L14
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L14:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -48(%rbp)
	movq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -80(%rbp)
	jmp	.L15
.L17:
	movq	-64(%rbp), %rdx
	movl	-80(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %eax
	cmpb	$82, %al
	jne	.L16
	addl	$1, -84(%rbp)
.L16:
	addl	$1, -80(%rbp)
.L15:
	movl	-92(%rbp), %eax
	cmpl	%eax, -80(%rbp)
	jl	.L17
	movl	-84(%rbp), %edx
	movl	-88(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movq	-48(%rbp), %rdx
	movl	%eax, (%rdx)
	movl	$0, -76(%rbp)
	jmp	.L18
.L21:
	movq	-64(%rbp), %rdx
	movl	-76(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %eax
	cmpb	$87, %al
	jne	.L19
	addl	$1, -88(%rbp)
	jmp	.L20
.L19:
	subl	$1, -84(%rbp)
.L20:
	movl	-76(%rbp), %eax
	leal	1(%rax), %ebx
	movl	-84(%rbp), %edx
	movl	-88(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movq	-48(%rbp), %rdx
	movslq	%ebx, %rcx
	movl	%eax, (%rdx,%rcx,4)
	addl	$1, -76(%rbp)
.L18:
	movl	-92(%rbp), %eax
	cmpl	%eax, -76(%rbp)
	jl	.L21
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movq	-48(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	array_min
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%r12, %rsp
	movq	-40(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leaq	-32(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	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	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.p2align 4
	.globl	array_min
	.type	array_min, @function
array_min:
.LFB24:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	movq	%rdi, %rdx
	movl	%esi, %ecx
	cmpl	$1, %esi
	jle	.L3
	leal	-1(%rsi), %edi
	leal	-2(%rsi), %esi
	cmpl	$2, %esi
	jbe	.L9
	movl	%edi, %esi
	movd	%eax, %xmm4
	leaq	4(%rdx), %rax
	shrl	$2, %esi
	pshufd	$0, %xmm4, %xmm0
	subl	$1, %esi
	salq	$4, %rsi
	leaq	20(%rdx,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L6:
	movdqu	(%rax), %xmm1
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm3, %xmm1
	por	%xmm1, %xmm0
	cmpq	%rsi, %rax
	jne	.L6
	movdqa	%xmm0, %xmm2
	movl	%edi, %r8d
	psrldq	$8, %xmm2
	andl	$-4, %r8d
	movdqa	%xmm2, %xmm1
	leal	1(%r8), %esi
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r8d, %edi
	je	.L11
.L5:
	movslq	%esi, %rdi
	leaq	0(,%rdi,4), %r8
	movl	(%rdx,%rdi,4), %edi
	cmpl	%edi, %eax
	cmovg	%edi, %eax
	leal	1(%rsi), %edi
	cmpl	%edi, %ecx
	jle	.L3
	movl	4(%rdx,%r8), %edi
	cmpl	%edi, %eax
	cmovg	%edi, %eax
	addl	$2, %esi
	cmpl	%esi, %ecx
	jle	.L3
	movl	8(%rdx,%r8), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
.L3:
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	ret
.L9:
	movl	$1, %esi
	jmp	.L5
	.cfi_endproc
.LFE24:
	.size	array_min, .-array_min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r13
	pushq	%r12
	leaq	-44(%rbp), %rsi
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 13, -24
	.cfi_offset 12, -32
	.cfi_offset 3, -40
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-44(%rbp), %rax
	movq	%rsp, %rsi
	movq	%rax, %rdx
	addq	$15, %rax
	movq	%rax, %rcx
	andq	$-4096, %rax
	subq	%rax, %rsi
	andq	$-16, %rcx
	cmpq	%rsi, %rsp
	je	.L14
.L61:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L61
.L14:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L62
.L15:
	addl	$1, %edx
	movq	%rsp, %rcx
	movq	%rsp, %rbx
	movslq	%edx, %rdx
	leaq	15(,%rdx,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rcx
.L16:
	cmpq	%rcx, %rsp
	je	.L17
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L16
.L62:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L15
.L17:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L63
.L18:
	leaq	.LC1(%rip), %rdi
	movq	%rbx, %rsi
	leaq	3(%rsp), %r12
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %edi
	movq	%r12, %r13
	andq	$-4, %r12
	shrq	$2, %r13
	testl	%edi, %edi
	jle	.L48
	leal	-1(%rdi), %r9d
	cmpl	$14, %r9d
	jbe	.L49
	movl	%edi, %edx
	pxor	%xmm1, %xmm1
	pxor	%xmm5, %xmm5
	movq	%rbx, %rax
	shrl	$4, %edx
	movdqa	.LC2(%rip), %xmm7
	movdqa	.LC3(%rip), %xmm6
	pxor	%xmm4, %xmm4
	salq	$4, %rdx
	addq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L21:
	movdqu	(%rax), %xmm0
	movdqa	%xmm5, %xmm3
	addq	$16, %rax
	pcmpeqb	%xmm7, %xmm0
	pand	%xmm6, %xmm0
	pcmpgtb	%xmm0, %xmm3
	movdqa	%xmm0, %xmm2
	punpcklbw	%xmm3, %xmm2
	punpckhbw	%xmm3, %xmm0
	movdqa	%xmm4, %xmm3
	pcmpgtw	%xmm2, %xmm3
	movdqa	%xmm2, %xmm8
	punpcklwd	%xmm3, %xmm8
	punpckhwd	%xmm3, %xmm2
	movdqa	%xmm0, %xmm3
	paddd	%xmm8, %xmm1
	paddd	%xmm2, %xmm1
	movdqa	%xmm4, %xmm2
	pcmpgtw	%xmm0, %xmm2
	punpcklwd	%xmm2, %xmm3
	punpckhwd	%xmm2, %xmm0
	paddd	%xmm3, %xmm1
	paddd	%xmm0, %xmm1
	cmpq	%rdx, %rax
	jne	.L21
	movdqa	%xmm1, %xmm0
	movl	%edi, %eax
	psrldq	$8, %xmm0
	andl	$-16, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$15, %dil
	je	.L22
.L20:
	movslq	%eax, %rcx
	cmpb	$82, (%rbx,%rcx)
	sete	%cl
	movzbl	%cl, %ecx
	addl	%ecx, %edx
	leal	1(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	sete	%cl
	movzbl	%cl, %ecx
	addl	%ecx, %edx
	leal	2(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L25
	addl	$1, %edx
.L25:
	leal	3(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L26
	addl	$1, %edx
.L26:
	leal	4(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L27
	addl	$1, %edx
.L27:
	leal	5(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L28
	addl	$1, %edx
.L28:
	leal	6(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L29
	addl	$1, %edx
.L29:
	leal	7(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L30
	addl	$1, %edx
.L30:
	leal	8(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L31
	addl	$1, %edx
.L31:
	leal	9(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L32
	addl	$1, %edx
.L32:
	leal	10(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L33
	addl	$1, %edx
.L33:
	leal	11(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L34
	addl	$1, %edx
.L34:
	leal	12(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L35
	addl	$1, %edx
.L35:
	leal	13(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L36
	addl	$1, %edx
.L36:
	addl	$14, %eax
	cmpl	%eax, %edi
	jle	.L22
	cltq
	cmpb	$82, (%rbx,%rax)
	jne	.L22
	addl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%edx, 0(,%r13,4)
	movl	%edi, %r10d
	movl	%edx, %ecx
	xorl	%eax, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L46:
	cmpb	$87, (%rbx,%rax)
	je	.L64
	subl	$1, %ecx
	movl	%esi, %r8d
	cmpl	%esi, %ecx
	cmovge	%ecx, %r8d
	movl	%r8d, 4(%r12,%rax,4)
	addq	$1, %rax
	cmpq	%r10, %rax
	jne	.L46
.L41:
	cmpl	$2, %r9d
	jbe	.L50
	movd	%edx, %xmm6
	movl	%edi, %edx
	leaq	4(%r12), %rax
	shrl	$2, %edx
	pshufd	$0, %xmm6, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%r12,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L43:
	movdqu	(%rax), %xmm1
	movdqu	(%rax), %xmm5
	addq	$16, %rax
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm5, %xmm1
	por	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L43
	movdqa	%xmm0, %xmm2
	movl	%edi, %ecx
	psrldq	$8, %xmm2
	andl	$-4, %ecx
	movdqa	%xmm2, %xmm1
	leal	1(%rcx), %eax
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movd	%xmm1, %edx
	cmpl	%edi, %ecx
	je	.L19
.L42:
	movslq	%eax, %rcx
	leaq	0(,%rcx,4), %rsi
	movl	(%r12,%rcx,4), %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	1(%rax), %ecx
	cmpl	%ecx, %edi
	jl	.L19
	movl	4(%r12,%rsi), %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	addl	$2, %eax
	cmpl	%eax, %edi
	jl	.L19
	movl	8(%r12,%rsi), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
.L19:
	xorl	%eax, %eax
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L65
	leaq	-24(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L64:
	.cfi_restore_state
	addl	$1, %esi
	movl	%ecx, %r8d
	cmpl	%ecx, %esi
	cmovge	%esi, %r8d
	movl	%r8d, 4(%r12,%rax,4)
	addq	$1, %rax
	cmpq	%r10, %rax
	jne	.L46
	jmp	.L41
.L48:
	xorl	%edx, %edx
	jmp	.L19
.L50:
	movl	$1, %eax
	jmp	.L42
.L49:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L20
.L63:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L18
.L65:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.align 16
.LC3:
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.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	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.p2align 4
	.globl	array_min
	.type	array_min, @function
array_min:
.LFB24:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	movq	%rdi, %rdx
	movl	%esi, %ecx
	cmpl	$1, %esi
	jle	.L3
	leal	-1(%rsi), %edi
	leal	-2(%rsi), %esi
	cmpl	$2, %esi
	jbe	.L9
	movl	%edi, %esi
	movd	%eax, %xmm4
	leaq	4(%rdx), %rax
	shrl	$2, %esi
	pshufd	$0, %xmm4, %xmm0
	subl	$1, %esi
	salq	$4, %rsi
	leaq	20(%rdx,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L6:
	movdqu	(%rax), %xmm1
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm3, %xmm1
	por	%xmm1, %xmm0
	cmpq	%rsi, %rax
	jne	.L6
	movdqa	%xmm0, %xmm2
	movl	%edi, %r8d
	psrldq	$8, %xmm2
	andl	$-4, %r8d
	movdqa	%xmm2, %xmm1
	leal	1(%r8), %esi
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r8d, %edi
	je	.L11
.L5:
	movslq	%esi, %rdi
	leaq	0(,%rdi,4), %r8
	movl	(%rdx,%rdi,4), %edi
	cmpl	%edi, %eax
	cmovg	%edi, %eax
	leal	1(%rsi), %edi
	cmpl	%edi, %ecx
	jle	.L3
	movl	4(%rdx,%r8), %edi
	cmpl	%edi, %eax
	cmovg	%edi, %eax
	addl	$2, %esi
	cmpl	%esi, %ecx
	jle	.L3
	movl	8(%rdx,%r8), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
.L3:
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	ret
.L9:
	movl	$1, %esi
	jmp	.L5
	.cfi_endproc
.LFE24:
	.size	array_min, .-array_min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r13
	pushq	%r12
	leaq	-44(%rbp), %rsi
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 13, -24
	.cfi_offset 12, -32
	.cfi_offset 3, -40
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-44(%rbp), %rax
	movq	%rsp, %rsi
	movq	%rax, %rdx
	addq	$15, %rax
	movq	%rax, %rcx
	andq	$-4096, %rax
	subq	%rax, %rsi
	andq	$-16, %rcx
	cmpq	%rsi, %rsp
	je	.L14
.L61:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L61
.L14:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L62
.L15:
	addl	$1, %edx
	movq	%rsp, %rcx
	movq	%rsp, %rbx
	movslq	%edx, %rdx
	leaq	15(,%rdx,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rcx
.L16:
	cmpq	%rcx, %rsp
	je	.L17
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L16
.L62:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L15
.L17:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L63
.L18:
	leaq	.LC1(%rip), %rdi
	movq	%rbx, %rsi
	leaq	3(%rsp), %r12
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %edi
	movq	%r12, %r13
	andq	$-4, %r12
	shrq	$2, %r13
	testl	%edi, %edi
	jle	.L48
	leal	-1(%rdi), %r9d
	cmpl	$14, %r9d
	jbe	.L49
	movl	%edi, %edx
	pxor	%xmm1, %xmm1
	pxor	%xmm5, %xmm5
	movq	%rbx, %rax
	shrl	$4, %edx
	movdqa	.LC2(%rip), %xmm7
	movdqa	.LC3(%rip), %xmm6
	pxor	%xmm4, %xmm4
	salq	$4, %rdx
	addq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L21:
	movdqu	(%rax), %xmm0
	movdqa	%xmm5, %xmm3
	addq	$16, %rax
	pcmpeqb	%xmm7, %xmm0
	pand	%xmm6, %xmm0
	pcmpgtb	%xmm0, %xmm3
	movdqa	%xmm0, %xmm2
	punpcklbw	%xmm3, %xmm2
	punpckhbw	%xmm3, %xmm0
	movdqa	%xmm4, %xmm3
	pcmpgtw	%xmm2, %xmm3
	movdqa	%xmm2, %xmm8
	punpcklwd	%xmm3, %xmm8
	punpckhwd	%xmm3, %xmm2
	movdqa	%xmm0, %xmm3
	paddd	%xmm8, %xmm1
	paddd	%xmm2, %xmm1
	movdqa	%xmm4, %xmm2
	pcmpgtw	%xmm0, %xmm2
	punpcklwd	%xmm2, %xmm3
	punpckhwd	%xmm2, %xmm0
	paddd	%xmm3, %xmm1
	paddd	%xmm0, %xmm1
	cmpq	%rdx, %rax
	jne	.L21
	movdqa	%xmm1, %xmm0
	movl	%edi, %eax
	psrldq	$8, %xmm0
	andl	$-16, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$15, %dil
	je	.L22
.L20:
	movslq	%eax, %rcx
	cmpb	$82, (%rbx,%rcx)
	sete	%cl
	movzbl	%cl, %ecx
	addl	%ecx, %edx
	leal	1(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	sete	%cl
	movzbl	%cl, %ecx
	addl	%ecx, %edx
	leal	2(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L25
	addl	$1, %edx
.L25:
	leal	3(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L26
	addl	$1, %edx
.L26:
	leal	4(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L27
	addl	$1, %edx
.L27:
	leal	5(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L28
	addl	$1, %edx
.L28:
	leal	6(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L29
	addl	$1, %edx
.L29:
	leal	7(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L30
	addl	$1, %edx
.L30:
	leal	8(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L31
	addl	$1, %edx
.L31:
	leal	9(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L32
	addl	$1, %edx
.L32:
	leal	10(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L33
	addl	$1, %edx
.L33:
	leal	11(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L34
	addl	$1, %edx
.L34:
	leal	12(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L35
	addl	$1, %edx
.L35:
	leal	13(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L22
	movslq	%ecx, %rcx
	cmpb	$82, (%rbx,%rcx)
	jne	.L36
	addl	$1, %edx
.L36:
	addl	$14, %eax
	cmpl	%eax, %edi
	jle	.L22
	cltq
	cmpb	$82, (%rbx,%rax)
	jne	.L22
	addl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%edx, 0(,%r13,4)
	movl	%edi, %r10d
	movl	%edx, %ecx
	xorl	%eax, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L46:
	cmpb	$87, (%rbx,%rax)
	je	.L64
	subl	$1, %ecx
	movl	%esi, %r8d
	cmpl	%esi, %ecx
	cmovge	%ecx, %r8d
	movl	%r8d, 4(%r12,%rax,4)
	addq	$1, %rax
	cmpq	%r10, %rax
	jne	.L46
.L41:
	cmpl	$2, %r9d
	jbe	.L50
	movd	%edx, %xmm6
	movl	%edi, %edx
	leaq	4(%r12), %rax
	shrl	$2, %edx
	pshufd	$0, %xmm6, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%r12,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L43:
	movdqu	(%rax), %xmm1
	movdqu	(%rax), %xmm5
	addq	$16, %rax
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm5, %xmm1
	por	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L43
	movdqa	%xmm0, %xmm2
	movl	%edi, %ecx
	psrldq	$8, %xmm2
	andl	$-4, %ecx
	movdqa	%xmm2, %xmm1
	leal	1(%rcx), %eax
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movd	%xmm1, %edx
	cmpl	%edi, %ecx
	je	.L19
.L42:
	movslq	%eax, %rcx
	leaq	0(,%rcx,4), %rsi
	movl	(%r12,%rcx,4), %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	1(%rax), %ecx
	cmpl	%ecx, %edi
	jl	.L19
	movl	4(%r12,%rsi), %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	addl	$2, %eax
	cmpl	%eax, %edi
	jl	.L19
	movl	8(%r12,%rsi), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
.L19:
	xorl	%eax, %eax
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L65
	leaq	-24(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L64:
	.cfi_restore_state
	addl	$1, %esi
	movl	%ecx, %r8d
	cmpl	%ecx, %esi
	cmovge	%esi, %r8d
	movl	%r8d, 4(%r12,%rax,4)
	addq	$1, %rax
	cmpq	%r10, %rax
	jne	.L46
	jmp	.L41
.L48:
	xorl	%edx, %edx
	jmp	.L19
.L50:
	movl	$1, %eax
	jmp	.L42
.L49:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L20
.L63:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L18
.L65:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.byte	82
	.align 16
.LC3:
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>

int max(int W,int R)
{
  return (W >= R) ? W : R;
}

int array_min(int array[],int e)
{
  int min = array[0];
  
  for(int i=1; i<e; i++)
    if(min > array[i])
      min = array[i];
  
  return min;
}

int main(void)
{
  int n;
  int left_w = 0,right_r=0;
  
  scanf("%d",&n);
  char c[n];
  int maxs[n+1];
  scanf("%s",c);
  
  for(int i=0; i<n; i++){
    if(c[i] == 'R')
      right_r++;
  }
  
  maxs[0] = max(left_w,right_r);
    
  for(int i=0; i<n; i++){
    if(c[i] == 'W')
      left_w++;
    else
      right_r--;
    
    maxs[i+1] = max(left_w,right_r);
  }
  
  printf("%d\n",array_min(maxs,n+1));
  
  return 0;
}
8
RRWRWWRW
 2
RQ
 8
RRWWWRRW
 8
WRWWWRRR
 8
WWWWRRRR
 8
RRWRVWRW
 4
RRWW
 4
RWWR
 2
RS
 4
RRVW

1
 0
 2
 3
 4
 1
 0
 1
 0
 0

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

```c
#include <stdio.h>

int max(int W,int R)
{
  return (W >= R) ? W : R;
}

int array_min(int array[],int e)
{
  int min = array[0];
  
  for(int i=1; i<e; i++)
    if(min > array[i])
      min = array[i];
  
  return min;
}

int main(void)
{
  int n;
  int left_w = 0,right_r=0;
  
  scanf("%d",&n);
  char c[n];
  int maxs[n+1];
  scanf("%s",c);
  
  for(int i=0; i<n; i++){
    if(c[i] == 'R')
      right_r++;
  }
  
  maxs[0] = max(left_w,right_r);
    
  for(int i=0; i<n; i++){
    if(c[i] == 'W')
      left_w++;
    else
      right_r--;
    
    maxs[i+1] = max(left_w,right_r);
  }
  
  printf("%d\n",array_min(maxs,n+1));
  
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.globl	array_min
	.type	array_min, @function
array_min:
.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, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L4
.L6:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L5
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
.L5:
	addl	$1, -4(%rbp)
.L4:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L6
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	array_min, .-array_min
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\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	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	subq	$112, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %r12
	movl	$0, -88(%rbp)
	movl	$0, -84(%rbp)
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-92(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -112(%rbp)
	movq	$0, -104(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -128(%rbp)
	movq	$0, -120(%rbp)
	cltq
	movl	$16, %edx
	subq	$1, %rdx
	addq	%rdx, %rax
	movl	$16, %ebx
	movl	$0, %edx
	divq	%rbx
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movl	-92(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -56(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %ebx
	movl	$0, %edx
	divq	%rbx
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L12:
	cmpq	%rdx, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L14
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L14:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -48(%rbp)
	movq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -80(%rbp)
	jmp	.L15
.L17:
	movq	-64(%rbp), %rdx
	movl	-80(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %eax
	cmpb	$82, %al
	jne	.L16
	addl	$1, -84(%rbp)
.L16:
	addl	$1, -80(%rbp)
.L15:
	movl	-92(%rbp), %eax
	cmpl	%eax, -80(%rbp)
	jl	.L17
	movl	-84(%rbp), %edx
	movl	-88(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movq	-48(%rbp), %rdx
	movl	%eax, (%rdx)
	movl	$0, -76(%rbp)
	jmp	.L18
.L21:
	movq	-64(%rbp), %rdx
	movl	-76(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %eax
	cmpb	$87, %al
	jne	.L19
	addl	$1, -88(%rbp)
	jmp	.L20
.L19:
	subl	$1, -84(%rbp)
.L20:
	movl	-76(%rbp), %eax
	leal	1(%rax), %ebx
	movl	-84(%rbp), %edx
	movl	-88(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movq	-48(%rbp), %rdx
	movslq	%ebx, %rcx
	movl	%eax, (%rdx,%rcx,4)
	addl	$1, -76(%rbp)
.L18:
	movl	-92(%rbp), %eax
	cmpl	%eax, -76(%rbp)
	jl	.L21
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movq	-48(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	array_min
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%r12, %rsp
	movq	-40(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leaq	-32(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	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	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.globl	array_min
	.type	array_min, @function
array_min:
.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, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L4
.L6:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L5
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
.L5:
	addl	$1, -4(%rbp)
.L4:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L6
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	array_min, .-array_min
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\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	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	subq	$112, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %r12
	movl	$0, -88(%rbp)
	movl	$0, -84(%rbp)
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-92(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -112(%rbp)
	movq	$0, -104(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -128(%rbp)
	movq	$0, -120(%rbp)
	cltq
	movl	$16, %edx
	subq	$1, %rdx
	addq	%rdx, %rax
	movl	$16, %ebx
	movl	$0, %edx
	divq	%rbx
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movl	-92(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -56(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %ebx
	movl	$0, %edx
	divq	%rbx
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L12:
	cmpq	%rdx, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L14
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L14:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -48(%rbp)
	movq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -80(%rbp)
	jmp	.L15
.L17:
	movq	-64(%rbp), %rdx
	movl	-80(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %eax
	cmpb	$82, %al
	jne	.L16
	addl	$1, -84(%rbp)
.L16:
	addl	$1, -80(%rbp)
.L15:
	movl	-92(%rbp), %eax
	cmpl	%eax, -80(%rbp)
	jl	.L17
	movl	-84(%rbp), %edx
	movl	-88(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movq	-48(%rbp), %rdx
	movl	%eax, (%rdx)
	movl	$0, -76(%rbp)
	jmp	.L18
.L21:
	movq	-64(%rbp), %rdx
	movl	-76(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %eax
	cmpb	$87, %al
	jne	.L19
	addl	$1, -88(%rbp)
	jmp	.L20
.L19:
	subl	$1, -84(%rbp)
.L20:
	movl	-76(%rbp), %eax
	leal	1(%rax), %ebx
	movl	-84(%rbp), %edx
	movl	-88(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movq	-48(%rbp), %rdx
	movslq	%ebx, %rcx
	movl	%eax, (%rdx,%rcx,4)
	addl	$1, -76(%rbp)
.L18:
	movl	-92(%rbp), %eax
	cmpl	%eax, -76(%rbp)
	jl	.L21
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movq	-48(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	array_min
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%r12, %rsp
	movq	-40(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leaq	-32(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	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:
