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

```c
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

char buffer[4 * 1024 * 1024];
int pos = 0;
int end = 0;

int mygetchar(){
  if(pos == end){
    end = read(0, buffer, sizeof(buffer));
    pos = 0;
  }
  return buffer[pos++];
}

#define ISDIGIT(x) ((x) >= '0') 

__attribute__((always_inline)) int getInt(){
  int ret = 0, c;
  c = mygetchar();
  while(!ISDIGIT(c)) c = mygetchar();
  while(ISDIGIT(c)){
    ret *= 10;
    ret += c - '0';
    c = mygetchar();
  }
  return ret;
}

#define mask (0x7F)
int cnt[mask];

int main(){
  int n, i;
  while(n = getInt()){
    const int n2 = n / 2;
    memset(cnt, 0, sizeof(cnt));

    for(i = 0; i < n; i++){
      int a = getInt();

      if(++cnt[a & mask] > n2){
	printf("%d\n", a);
	for(++i; i < n; i++)
	  getInt();
	goto end;
      }
    }

    puts("NO COLOR");

  end:;
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	buffer
	.bss
	.align 32
	.type	buffer, @object
	.size	buffer, 4194304
buffer:
	.zero	4194304
	.globl	pos
	.align 4
	.type	pos, @object
	.size	pos, 4
pos:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.text
	.globl	mygetchar
	.type	mygetchar, @function
mygetchar:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	pos(%rip), %edx
	movl	end(%rip), %eax
	cmpl	%eax, %edx
	jne	.L2
	movl	$4194304, %edx
	leaq	buffer(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	movl	$0, %eax
	call	read@PLT
	movl	%eax, end(%rip)
	movl	$0, pos(%rip)
.L2:
	movl	pos(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, pos(%rip)
	cltq
	leaq	buffer(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	mygetchar, .-mygetchar
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
	jmp	.L5
.L6:
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
.L5:
	cmpl	$47, -4(%rbp)
	jle	.L6
	jmp	.L7
.L8:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -8(%rbp)
	movl	-4(%rbp), %eax
	subl	$48, %eax
	addl	%eax, -8(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
.L7:
	cmpl	$47, -4(%rbp)
	jg	.L8
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	getInt, .-getInt
	.globl	cnt
	.bss
	.align 32
	.type	cnt, @object
	.size	cnt, 508
cnt:
	.zero	508
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"NO COLOR"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	jmp	.L11
.L33:
	movl	-36(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -32(%rbp)
	movl	$508, %edx
	movl	$0, %esi
	leaq	cnt(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -40(%rbp)
	jmp	.L12
.L27:
	movl	$0, -24(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -20(%rbp)
	jmp	.L13
.L14:
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -20(%rbp)
.L13:
	cmpl	$47, -20(%rbp)
	jle	.L14
	jmp	.L15
.L16:
	movl	-24(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	subl	$48, %eax
	addl	%eax, -24(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -20(%rbp)
.L15:
	cmpl	$47, -20(%rbp)
	jg	.L16
	movl	-24(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-28(%rbp), %eax
	andl	$127, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	cnt(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %esi
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	cnt(%rip), %rdx
	movl	%esi, (%rcx,%rdx)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L18
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40(%rbp)
	jmp	.L19
.L25:
	movl	$0, -16(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -12(%rbp)
	jmp	.L20
.L21:
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -12(%rbp)
.L20:
	cmpl	$47, -12(%rbp)
	jle	.L21
	jmp	.L22
.L23:
	movl	-16(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	subl	$48, %eax
	addl	%eax, -16(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -12(%rbp)
.L22:
	cmpl	$47, -12(%rbp)
	jg	.L23
	nop
	addl	$1, -40(%rbp)
.L19:
	movl	-40(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L25
	jmp	.L11
.L18:
	addl	$1, -40(%rbp)
.L12:
	movl	-40(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L27
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L26:
.L11:
	movl	$0, -8(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
	jmp	.L28
.L29:
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
.L28:
	cmpl	$47, -4(%rbp)
	jle	.L29
	jmp	.L30
.L31:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -8(%rbp)
	movl	-4(%rbp), %eax
	subl	$48, %eax
	addl	%eax, -8(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
.L30:
	cmpl	$47, -4(%rbp)
	jg	.L31
	movl	-8(%rbp), %eax
	movl	%eax, -36(%rbp)
	cmpl	$0, -36(%rbp)
	jne	.L33
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	mygetchar
	.type	mygetchar, @function
mygetchar:
.LFB51:
	.cfi_startproc
	endbr64
	movslq	pos(%rip), %rax
	cmpl	end(%rip), %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	je	.L2
	leal	1(%rax), %edx
	leaq	buffer(%rip), %rbx
	movsbl	(%rbx,%rax), %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	movl	%edx, pos(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	leaq	buffer(%rip), %rbx
	movl	$4194304, %edx
	xorl	%edi, %edi
	xorl	%eax, %eax
	movq	%rbx, %rsi
	call	read@PLT
	movl	$1, %edx
	movl	%eax, end(%rip)
	xorl	%eax, %eax
	movsbl	(%rbx,%rax), %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	movl	%edx, pos(%rip)
	ret
	.cfi_endproc
.LFE51:
	.size	mygetchar, .-mygetchar
	.p2align 4
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movslq	pos(%rip), %rdx
	movl	end(%rip), %eax
	cmpl	%eax, %edx
	je	.L7
	leaq	buffer(%rip), %rbx
	leal	1(%rdx), %ecx
	movsbl	(%rbx,%rdx), %esi
	movl	%ecx, pos(%rip)
	cmpl	$47, %esi
	jg	.L17
.L12:
	cmpl	%eax, %ecx
	je	.L10
	.p2align 4,,10
	.p2align 3
.L20:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movsbl	(%rbx,%rcx), %esi
	movl	%edx, pos(%rip)
	cmpl	$47, %esi
	jg	.L9
.L11:
	movl	%edx, %ecx
	cmpl	%eax, %ecx
	jne	.L20
.L10:
	movl	$4194304, %edx
	movq	%rbx, %rsi
	xorl	%edi, %edi
	xorl	%eax, %eax
	call	read@PLT
	movsbl	(%rbx), %esi
	movl	$1, %edx
	movl	$1, pos(%rip)
	movl	%eax, end(%rip)
	cmpl	$47, %esi
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L9:
	xorl	%r12d, %r12d
	leal	(%r12,%r12,4), %ecx
	leal	-48(%rsi,%rcx,2), %r12d
	cmpl	%eax, %edx
	je	.L13
	.p2align 4,,10
	.p2align 3
.L21:
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movsbl	(%rbx,%rdx), %esi
	movl	%ecx, pos(%rip)
	cmpl	$47, %esi
	jle	.L6
	movl	%ecx, %edx
.L22:
	leal	(%r12,%r12,4), %ecx
	leal	-48(%rsi,%rcx,2), %r12d
	cmpl	%eax, %edx
	jne	.L21
.L13:
	movq	%rbx, %rsi
	movl	$4194304, %edx
	xorl	%edi, %edi
	xorl	%eax, %eax
	call	read@PLT
	movsbl	(%rbx), %esi
	movl	$1, pos(%rip)
	movl	%eax, end(%rip)
	cmpl	$47, %esi
	jle	.L6
	movl	$1, %ecx
	movl	%ecx, %edx
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L6:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movl	%r12d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	leaq	buffer(%rip), %rbx
	movl	$4194304, %edx
	xorl	%edi, %edi
	xorl	%eax, %eax
	movq	%rbx, %rsi
	call	read@PLT
	xorl	%edx, %edx
	movl	$1, %ecx
	movsbl	(%rbx,%rdx), %esi
	movl	%eax, end(%rip)
	movl	%ecx, pos(%rip)
	cmpl	$47, %esi
	jle	.L12
.L17:
	movl	%ecx, %edx
	jmp	.L9
	.cfi_endproc
.LFE52:
	.size	getInt, .-getInt
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"NO COLOR"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	buffer(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	cnt(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	pos(%rip), %esi
	movl	end(%rip), %ecx
.L24:
	cmpl	%ecx, %esi
	je	.L50
.L81:
	leal	1(%rsi), %edx
.L51:
	movslq	%esi, %rsi
	movl	%edx, pos(%rip)
	movsbl	(%r15,%rsi), %edi
	cmpl	$47, %edi
	jg	.L67
	cmpl	%ecx, %edx
	je	.L53
	.p2align 4,,10
	.p2align 3
.L75:
	leal	1(%rdx), %eax
	movslq	%edx, %rdx
	movsbl	(%r15,%rdx), %edi
	movl	%eax, pos(%rip)
	cmpl	$47, %edi
	jg	.L52
.L54:
	movl	%eax, %edx
	cmpl	%ecx, %edx
	jne	.L75
.L53:
	xorl	%edi, %edi
	movl	$4194304, %edx
	movq	%r15, %rsi
	xorl	%eax, %eax
	call	read@PLT
	movsbl	(%r15), %edi
	movl	$1, pos(%rip)
	movl	%eax, end(%rip)
	movl	%eax, %ecx
	movl	$1, %eax
	cmpl	$47, %edi
	jle	.L54
	.p2align 4,,10
	.p2align 3
.L52:
	xorl	%ebx, %ebx
	leal	(%rbx,%rbx,4), %edx
	leal	-48(%rdi,%rdx,2), %ebx
	cmpl	%ecx, %eax
	je	.L56
	.p2align 4,,10
	.p2align 3
.L76:
	leal	1(%rax), %esi
	cltq
	movsbl	(%r15,%rax), %edi
	movl	%esi, pos(%rip)
	cmpl	$47, %edi
	jle	.L58
.L57:
	leal	(%rbx,%rbx,4), %edx
	movl	%esi, %eax
	leal	-48(%rdi,%rdx,2), %ebx
	cmpl	%ecx, %eax
	jne	.L76
.L56:
	movq	%r15, %rsi
	xorl	%edi, %edi
	movl	$4194304, %edx
	xorl	%eax, %eax
	call	read@PLT
	movsbl	(%r15), %edi
	movl	$1, %esi
	movl	$1, pos(%rip)
	movl	%eax, end(%rip)
	movl	%eax, %ecx
	cmpl	$47, %edi
	jg	.L57
.L58:
	testl	%ebx, %ebx
	je	.L77
	movl	%ebx, %eax
	movl	$63, %ecx
	movq	%r13, %rdi
	xorl	%r12d, %r12d
	sarl	%eax
	movl	%eax, 12(%rsp)
	xorl	%eax, %eax
	rep stosq
	movl	$0, (%rdi)
	.p2align 4,,10
	.p2align 3
.L49:
	movl	end(%rip), %edi
	cmpl	%esi, %edi
	je	.L25
	leal	1(%rsi), %edx
.L26:
	movslq	%esi, %rsi
	movl	%edx, pos(%rip)
	movsbl	(%r15,%rsi), %ecx
	cmpl	$47, %ecx
	jg	.L61
	cmpl	%edi, %edx
	je	.L28
	.p2align 4,,10
	.p2align 3
.L78:
	leal	1(%rdx), %eax
	movslq	%edx, %rdx
	movsbl	(%r15,%rdx), %ecx
	movl	%eax, pos(%rip)
	cmpl	$47, %ecx
	jg	.L27
.L29:
	movl	%eax, %edx
	cmpl	%edi, %edx
	jne	.L78
.L28:
	xorl	%edi, %edi
	movl	$4194304, %edx
	movq	%r15, %rsi
	xorl	%eax, %eax
	call	read@PLT
	movsbl	(%r15), %ecx
	movl	%ebp, pos(%rip)
	movl	%eax, end(%rip)
	movl	%eax, %edi
	movl	$1, %eax
	cmpl	$47, %ecx
	jle	.L29
	.p2align 4,,10
	.p2align 3
.L27:
	xorl	%r14d, %r14d
	leal	(%r14,%r14,4), %edx
	leal	-48(%rcx,%rdx,2), %r14d
	cmpl	%edi, %eax
	je	.L31
	.p2align 4,,10
	.p2align 3
.L79:
	leal	1(%rax), %esi
	cltq
	movsbl	(%r15,%rax), %ecx
	movl	%esi, pos(%rip)
	cmpl	$47, %ecx
	jle	.L33
.L32:
	leal	(%r14,%r14,4), %edx
	movl	%esi, %eax
	leal	-48(%rcx,%rdx,2), %r14d
	cmpl	%edi, %eax
	jne	.L79
.L31:
	movq	%r15, %rsi
	xorl	%edi, %edi
	movl	$4194304, %edx
	xorl	%eax, %eax
	call	read@PLT
	movsbl	(%r15), %ecx
	movl	%ebp, pos(%rip)
	movl	$1, %esi
	movl	%eax, end(%rip)
	movl	%eax, %edi
	cmpl	$47, %ecx
	jg	.L32
.L33:
	movl	%r14d, %edx
	addl	$1, %r12d
	andl	$127, %edx
	movl	0(%r13,%rdx,4), %eax
	addl	$1, %eax
	movl	%eax, 0(%r13,%rdx,4)
	cmpl	12(%rsp), %eax
	jg	.L80
	cmpl	%r12d, %ebx
	jne	.L49
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	movl	pos(%rip), %esi
	movl	end(%rip), %ecx
	cmpl	%ecx, %esi
	jne	.L81
.L50:
	movl	$4194304, %edx
	movq	%r15, %rsi
	xorl	%edi, %edi
	xorl	%eax, %eax
	call	read@PLT
	movl	$1, %edx
	xorl	%esi, %esi
	movl	%eax, end(%rip)
	movl	%eax, %ecx
	jmp	.L51
	.p2align 4,,10
	.p2align 3
.L25:
	movl	$4194304, %edx
	movq	%r15, %rsi
	xorl	%edi, %edi
	xorl	%eax, %eax
	call	read@PLT
	movl	$1, %edx
	xorl	%esi, %esi
	movl	%eax, end(%rip)
	movl	%eax, %edi
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L61:
	movl	%edx, %eax
	jmp	.L27
.L80:
	leaq	.LC0(%rip), %rsi
	movl	%r14d, %edx
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	pos(%rip), %esi
	movl	end(%rip), %ecx
	cmpl	%r12d, %ebx
	jle	.L24
	cmpl	%ecx, %esi
	je	.L38
	.p2align 4,,10
	.p2align 3
.L84:
	leal	1(%rsi), %edx
	movslq	%esi, %rsi
	cmpb	$47, (%r15,%rsi)
	movl	%edx, pos(%rip)
	jg	.L64
.L43:
	cmpl	%ecx, %edx
	je	.L41
	.p2align 4,,10
	.p2align 3
.L82:
	leal	1(%rdx), %eax
	movslq	%edx, %rdx
	cmpb	$47, (%r15,%rdx)
	movl	%eax, pos(%rip)
	jg	.L47
.L42:
	movl	%eax, %edx
	cmpl	%ecx, %edx
	jne	.L82
.L41:
	xorl	%edi, %edi
	xorl	%eax, %eax
	movl	$4194304, %edx
	movq	%r15, %rsi
	call	read@PLT
	cmpb	$47, (%r15)
	movl	%ebp, pos(%rip)
	movl	%eax, end(%rip)
	movl	%eax, %ecx
	movl	$1, %eax
	jle	.L42
	.p2align 4,,10
	.p2align 3
.L47:
	cmpl	%ecx, %eax
	je	.L44
	.p2align 4,,10
	.p2align 3
.L83:
	leal	1(%rax), %esi
	cltq
	cmpb	$47, (%r15,%rax)
	movl	%esi, pos(%rip)
	jle	.L46
.L45:
	movl	%esi, %eax
	cmpl	%ecx, %eax
	jne	.L83
.L44:
	movq	%r15, %rsi
	xorl	%edi, %edi
	xorl	%eax, %eax
	movl	$4194304, %edx
	call	read@PLT
	cmpb	$47, (%r15)
	movl	%ebp, pos(%rip)
	movl	$1, %esi
	movl	%eax, end(%rip)
	movl	%eax, %ecx
	jg	.L45
.L46:
	addl	$1, %r12d
	cmpl	%ebx, %r12d
	je	.L24
	cmpl	%ecx, %esi
	jne	.L84
.L38:
	movl	$4194304, %edx
	movq	%r15, %rsi
	xorl	%edi, %edi
	xorl	%eax, %eax
	call	read@PLT
	xorl	%esi, %esi
	movl	$1, %edx
	movslq	%esi, %rsi
	movl	%eax, end(%rip)
	movl	%eax, %ecx
	cmpb	$47, (%r15,%rsi)
	movl	%edx, pos(%rip)
	jle	.L43
.L64:
	movl	%edx, %eax
	jmp	.L47
.L77:
	addq	$24, %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
.L67:
	.cfi_restore_state
	movl	%edx, %eax
	jmp	.L52
	.cfi_endproc
.LFE53:
	.size	main, .-main
	.globl	cnt
	.bss
	.align 32
	.type	cnt, @object
	.size	cnt, 508
cnt:
	.zero	508
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	pos
	.align 4
	.type	pos, @object
	.size	pos, 4
pos:
	.zero	4
	.globl	buffer
	.align 32
	.type	buffer, @object
	.size	buffer, 4194304
buffer:
	.zero	4194304
	.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	mygetchar
	.type	mygetchar, @function
mygetchar:
.LFB51:
	.cfi_startproc
	endbr64
	movslq	pos(%rip), %rax
	cmpl	end(%rip), %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	je	.L2
	leal	1(%rax), %edx
	leaq	buffer(%rip), %rbx
	movsbl	(%rbx,%rax), %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	movl	%edx, pos(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	leaq	buffer(%rip), %rbx
	movl	$4194304, %edx
	xorl	%edi, %edi
	xorl	%eax, %eax
	movq	%rbx, %rsi
	call	read@PLT
	movl	$1, %edx
	movl	%eax, end(%rip)
	xorl	%eax, %eax
	movsbl	(%rbx,%rax), %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	movl	%edx, pos(%rip)
	ret
	.cfi_endproc
.LFE51:
	.size	mygetchar, .-mygetchar
	.p2align 4
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movslq	pos(%rip), %rdx
	movl	end(%rip), %eax
	cmpl	%eax, %edx
	je	.L7
	leaq	buffer(%rip), %rbx
	leal	1(%rdx), %ecx
	movsbl	(%rbx,%rdx), %esi
	movl	%ecx, pos(%rip)
	cmpl	$47, %esi
	jg	.L17
.L12:
	cmpl	%eax, %ecx
	je	.L10
	.p2align 4,,10
	.p2align 3
.L20:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movsbl	(%rbx,%rcx), %esi
	movl	%edx, pos(%rip)
	cmpl	$47, %esi
	jg	.L9
.L11:
	movl	%edx, %ecx
	cmpl	%eax, %ecx
	jne	.L20
.L10:
	movl	$4194304, %edx
	movq	%rbx, %rsi
	xorl	%edi, %edi
	xorl	%eax, %eax
	call	read@PLT
	movsbl	(%rbx), %esi
	movl	$1, %edx
	movl	$1, pos(%rip)
	movl	%eax, end(%rip)
	cmpl	$47, %esi
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L9:
	xorl	%r12d, %r12d
	leal	(%r12,%r12,4), %ecx
	leal	-48(%rsi,%rcx,2), %r12d
	cmpl	%eax, %edx
	je	.L13
	.p2align 4,,10
	.p2align 3
.L21:
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movsbl	(%rbx,%rdx), %esi
	movl	%ecx, pos(%rip)
	cmpl	$47, %esi
	jle	.L6
	movl	%ecx, %edx
.L22:
	leal	(%r12,%r12,4), %ecx
	leal	-48(%rsi,%rcx,2), %r12d
	cmpl	%eax, %edx
	jne	.L21
.L13:
	movq	%rbx, %rsi
	movl	$4194304, %edx
	xorl	%edi, %edi
	xorl	%eax, %eax
	call	read@PLT
	movsbl	(%rbx), %esi
	movl	$1, pos(%rip)
	movl	%eax, end(%rip)
	cmpl	$47, %esi
	jle	.L6
	movl	$1, %ecx
	movl	%ecx, %edx
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L6:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movl	%r12d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	leaq	buffer(%rip), %rbx
	movl	$4194304, %edx
	xorl	%edi, %edi
	xorl	%eax, %eax
	movq	%rbx, %rsi
	call	read@PLT
	xorl	%edx, %edx
	movl	$1, %ecx
	movsbl	(%rbx,%rdx), %esi
	movl	%eax, end(%rip)
	movl	%ecx, pos(%rip)
	cmpl	$47, %esi
	jle	.L12
.L17:
	movl	%ecx, %edx
	jmp	.L9
	.cfi_endproc
.LFE52:
	.size	getInt, .-getInt
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"NO COLOR"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	buffer(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	cnt(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	pos(%rip), %esi
	movl	end(%rip), %ecx
.L24:
	cmpl	%ecx, %esi
	je	.L50
.L81:
	leal	1(%rsi), %edx
.L51:
	movslq	%esi, %rsi
	movl	%edx, pos(%rip)
	movsbl	(%r15,%rsi), %edi
	cmpl	$47, %edi
	jg	.L67
	cmpl	%ecx, %edx
	je	.L53
	.p2align 4,,10
	.p2align 3
.L75:
	leal	1(%rdx), %eax
	movslq	%edx, %rdx
	movsbl	(%r15,%rdx), %edi
	movl	%eax, pos(%rip)
	cmpl	$47, %edi
	jg	.L52
.L54:
	movl	%eax, %edx
	cmpl	%ecx, %edx
	jne	.L75
.L53:
	xorl	%edi, %edi
	movl	$4194304, %edx
	movq	%r15, %rsi
	xorl	%eax, %eax
	call	read@PLT
	movsbl	(%r15), %edi
	movl	$1, pos(%rip)
	movl	%eax, end(%rip)
	movl	%eax, %ecx
	movl	$1, %eax
	cmpl	$47, %edi
	jle	.L54
	.p2align 4,,10
	.p2align 3
.L52:
	xorl	%ebx, %ebx
	leal	(%rbx,%rbx,4), %edx
	leal	-48(%rdi,%rdx,2), %ebx
	cmpl	%ecx, %eax
	je	.L56
	.p2align 4,,10
	.p2align 3
.L76:
	leal	1(%rax), %esi
	cltq
	movsbl	(%r15,%rax), %edi
	movl	%esi, pos(%rip)
	cmpl	$47, %edi
	jle	.L58
.L57:
	leal	(%rbx,%rbx,4), %edx
	movl	%esi, %eax
	leal	-48(%rdi,%rdx,2), %ebx
	cmpl	%ecx, %eax
	jne	.L76
.L56:
	movq	%r15, %rsi
	xorl	%edi, %edi
	movl	$4194304, %edx
	xorl	%eax, %eax
	call	read@PLT
	movsbl	(%r15), %edi
	movl	$1, %esi
	movl	$1, pos(%rip)
	movl	%eax, end(%rip)
	movl	%eax, %ecx
	cmpl	$47, %edi
	jg	.L57
.L58:
	testl	%ebx, %ebx
	je	.L77
	movl	%ebx, %eax
	movl	$63, %ecx
	movq	%r13, %rdi
	xorl	%r12d, %r12d
	sarl	%eax
	movl	%eax, 12(%rsp)
	xorl	%eax, %eax
	rep stosq
	movl	$0, (%rdi)
	.p2align 4,,10
	.p2align 3
.L49:
	movl	end(%rip), %edi
	cmpl	%esi, %edi
	je	.L25
	leal	1(%rsi), %edx
.L26:
	movslq	%esi, %rsi
	movl	%edx, pos(%rip)
	movsbl	(%r15,%rsi), %ecx
	cmpl	$47, %ecx
	jg	.L61
	cmpl	%edi, %edx
	je	.L28
	.p2align 4,,10
	.p2align 3
.L78:
	leal	1(%rdx), %eax
	movslq	%edx, %rdx
	movsbl	(%r15,%rdx), %ecx
	movl	%eax, pos(%rip)
	cmpl	$47, %ecx
	jg	.L27
.L29:
	movl	%eax, %edx
	cmpl	%edi, %edx
	jne	.L78
.L28:
	xorl	%edi, %edi
	movl	$4194304, %edx
	movq	%r15, %rsi
	xorl	%eax, %eax
	call	read@PLT
	movsbl	(%r15), %ecx
	movl	%ebp, pos(%rip)
	movl	%eax, end(%rip)
	movl	%eax, %edi
	movl	$1, %eax
	cmpl	$47, %ecx
	jle	.L29
	.p2align 4,,10
	.p2align 3
.L27:
	xorl	%r14d, %r14d
	leal	(%r14,%r14,4), %edx
	leal	-48(%rcx,%rdx,2), %r14d
	cmpl	%edi, %eax
	je	.L31
	.p2align 4,,10
	.p2align 3
.L79:
	leal	1(%rax), %esi
	cltq
	movsbl	(%r15,%rax), %ecx
	movl	%esi, pos(%rip)
	cmpl	$47, %ecx
	jle	.L33
.L32:
	leal	(%r14,%r14,4), %edx
	movl	%esi, %eax
	leal	-48(%rcx,%rdx,2), %r14d
	cmpl	%edi, %eax
	jne	.L79
.L31:
	movq	%r15, %rsi
	xorl	%edi, %edi
	movl	$4194304, %edx
	xorl	%eax, %eax
	call	read@PLT
	movsbl	(%r15), %ecx
	movl	%ebp, pos(%rip)
	movl	$1, %esi
	movl	%eax, end(%rip)
	movl	%eax, %edi
	cmpl	$47, %ecx
	jg	.L32
.L33:
	movl	%r14d, %edx
	addl	$1, %r12d
	andl	$127, %edx
	movl	0(%r13,%rdx,4), %eax
	addl	$1, %eax
	movl	%eax, 0(%r13,%rdx,4)
	cmpl	12(%rsp), %eax
	jg	.L80
	cmpl	%r12d, %ebx
	jne	.L49
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	movl	pos(%rip), %esi
	movl	end(%rip), %ecx
	cmpl	%ecx, %esi
	jne	.L81
.L50:
	movl	$4194304, %edx
	movq	%r15, %rsi
	xorl	%edi, %edi
	xorl	%eax, %eax
	call	read@PLT
	movl	$1, %edx
	xorl	%esi, %esi
	movl	%eax, end(%rip)
	movl	%eax, %ecx
	jmp	.L51
	.p2align 4,,10
	.p2align 3
.L25:
	movl	$4194304, %edx
	movq	%r15, %rsi
	xorl	%edi, %edi
	xorl	%eax, %eax
	call	read@PLT
	movl	$1, %edx
	xorl	%esi, %esi
	movl	%eax, end(%rip)
	movl	%eax, %edi
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L61:
	movl	%edx, %eax
	jmp	.L27
.L80:
	leaq	.LC0(%rip), %rsi
	movl	%r14d, %edx
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	pos(%rip), %esi
	movl	end(%rip), %ecx
	cmpl	%r12d, %ebx
	jle	.L24
	cmpl	%ecx, %esi
	je	.L38
	.p2align 4,,10
	.p2align 3
.L84:
	leal	1(%rsi), %edx
	movslq	%esi, %rsi
	cmpb	$47, (%r15,%rsi)
	movl	%edx, pos(%rip)
	jg	.L64
.L43:
	cmpl	%ecx, %edx
	je	.L41
	.p2align 4,,10
	.p2align 3
.L82:
	leal	1(%rdx), %eax
	movslq	%edx, %rdx
	cmpb	$47, (%r15,%rdx)
	movl	%eax, pos(%rip)
	jg	.L47
.L42:
	movl	%eax, %edx
	cmpl	%ecx, %edx
	jne	.L82
.L41:
	xorl	%edi, %edi
	xorl	%eax, %eax
	movl	$4194304, %edx
	movq	%r15, %rsi
	call	read@PLT
	cmpb	$47, (%r15)
	movl	%ebp, pos(%rip)
	movl	%eax, end(%rip)
	movl	%eax, %ecx
	movl	$1, %eax
	jle	.L42
	.p2align 4,,10
	.p2align 3
.L47:
	cmpl	%ecx, %eax
	je	.L44
	.p2align 4,,10
	.p2align 3
.L83:
	leal	1(%rax), %esi
	cltq
	cmpb	$47, (%r15,%rax)
	movl	%esi, pos(%rip)
	jle	.L46
.L45:
	movl	%esi, %eax
	cmpl	%ecx, %eax
	jne	.L83
.L44:
	movq	%r15, %rsi
	xorl	%edi, %edi
	xorl	%eax, %eax
	movl	$4194304, %edx
	call	read@PLT
	cmpb	$47, (%r15)
	movl	%ebp, pos(%rip)
	movl	$1, %esi
	movl	%eax, end(%rip)
	movl	%eax, %ecx
	jg	.L45
.L46:
	addl	$1, %r12d
	cmpl	%ebx, %r12d
	je	.L24
	cmpl	%ecx, %esi
	jne	.L84
.L38:
	movl	$4194304, %edx
	movq	%r15, %rsi
	xorl	%edi, %edi
	xorl	%eax, %eax
	call	read@PLT
	xorl	%esi, %esi
	movl	$1, %edx
	movslq	%esi, %rsi
	movl	%eax, end(%rip)
	movl	%eax, %ecx
	cmpb	$47, (%r15,%rsi)
	movl	%edx, pos(%rip)
	jle	.L43
.L64:
	movl	%edx, %eax
	jmp	.L47
.L77:
	addq	$24, %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
.L67:
	.cfi_restore_state
	movl	%edx, %eax
	jmp	.L52
	.cfi_endproc
.LFE53:
	.size	main, .-main
	.globl	cnt
	.bss
	.align 32
	.type	cnt, @object
	.size	cnt, 508
cnt:
	.zero	508
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	pos
	.align 4
	.type	pos, @object
	.size	pos, 4
pos:
	.zero	4
	.globl	buffer
	.align 32
	.type	buffer, @object
	.size	buffer, 4194304
buffer:
	.zero	4194304
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

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

char buffer[4 * 1024 * 1024];
int pos = 0;
int end = 0;

int mygetchar(){
  if(pos == end){
    end = read(0, buffer, sizeof(buffer));
    pos = 0;
  }
  return buffer[pos++];
}

#define ISDIGIT(x) ((x) >= '0') 

__attribute__((always_inline)) int getInt(){
  int ret = 0, c;
  c = mygetchar();
  while(!ISDIGIT(c)) c = mygetchar();
  while(ISDIGIT(c)){
    ret *= 10;
    ret += c - '0';
    c = mygetchar();
  }
  return ret;
}

#define mask (0x7F)
int cnt[mask];

int main(){
  int n, i;
  while(n = getInt()){
    const int n2 = n / 2;
    memset(cnt, 0, sizeof(cnt));

    for(i = 0; i < n; i++){
      int a = getInt();

      if(++cnt[a & mask] > n2){
	printf("%d\n", a);
	for(++i; i < n; i++)
	  getInt();
	goto end;
      }
    }

    puts("NO COLOR");

  end:;
  }
  return 0;
}
8
3 1 2 3 3 1 5 3
7
5 2 5 3 4 0 5
0
 8
3 1 2 3 3 1 5 3
7
5 0 5 3 4 5 5
0
 8
3 1 3 3 3 1 5 3
7
1 2 0 3 4 0 5
0
 8
2 3 0 3 6 4 6 9
7
0 4 0 5 6 0 0
0
 8
3 0 3 3 3 1 5 3
7
5 2 5 3 4 5 5
0
 8
4 1 3 3 0 1 4 3
0
0 3 1 5 7 1 5
0
 8
4 1 3 3 0 2 4 5
7
1 1 1 3 7 1 5
0
 8
1 1 2 1 1 1 16 0
7
3 1 -1 3 0 0 5
0
 8
3 1 2 3 3 1 5 3
7
5 2 0 3 4 0 5
0
 8
3 1 2 3 3 1 5 3
7
7 0 5 3 4 5 5
0

NO COLOR
NO COLOR
 NO COLOR
5
 3
NO COLOR
 NO COLOR
0
 3
5
 NO COLOR
 NO COLOR
1
 1
NO COLOR
 NO COLOR
NO COLOR
 NO COLOR
NO COLOR

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

```c
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

char buffer[4 * 1024 * 1024];
int pos = 0;
int end = 0;

int mygetchar(){
  if(pos == end){
    end = read(0, buffer, sizeof(buffer));
    pos = 0;
  }
  return buffer[pos++];
}

#define ISDIGIT(x) ((x) >= '0') 

__attribute__((always_inline)) int getInt(){
  int ret = 0, c;
  c = mygetchar();
  while(!ISDIGIT(c)) c = mygetchar();
  while(ISDIGIT(c)){
    ret *= 10;
    ret += c - '0';
    c = mygetchar();
  }
  return ret;
}

#define mask (0x7F)
int cnt[mask];

int main(){
  int n, i;
  while(n = getInt()){
    const int n2 = n / 2;
    memset(cnt, 0, sizeof(cnt));

    for(i = 0; i < n; i++){
      int a = getInt();

      if(++cnt[a & mask] > n2){
	printf("%d\n", a);
	for(++i; i < n; i++)
	  getInt();
	goto end;
      }
    }

    puts("NO COLOR");

  end:;
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	buffer
	.bss
	.align 32
	.type	buffer, @object
	.size	buffer, 4194304
buffer:
	.zero	4194304
	.globl	pos
	.align 4
	.type	pos, @object
	.size	pos, 4
pos:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.text
	.globl	mygetchar
	.type	mygetchar, @function
mygetchar:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	pos(%rip), %edx
	movl	end(%rip), %eax
	cmpl	%eax, %edx
	jne	.L2
	movl	$4194304, %edx
	leaq	buffer(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	movl	$0, %eax
	call	read@PLT
	movl	%eax, end(%rip)
	movl	$0, pos(%rip)
.L2:
	movl	pos(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, pos(%rip)
	cltq
	leaq	buffer(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	mygetchar, .-mygetchar
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
	jmp	.L5
.L6:
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
.L5:
	cmpl	$47, -4(%rbp)
	jle	.L6
	jmp	.L7
.L8:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -8(%rbp)
	movl	-4(%rbp), %eax
	subl	$48, %eax
	addl	%eax, -8(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
.L7:
	cmpl	$47, -4(%rbp)
	jg	.L8
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	getInt, .-getInt
	.globl	cnt
	.bss
	.align 32
	.type	cnt, @object
	.size	cnt, 508
cnt:
	.zero	508
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"NO COLOR"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	jmp	.L11
.L33:
	movl	-36(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -32(%rbp)
	movl	$508, %edx
	movl	$0, %esi
	leaq	cnt(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -40(%rbp)
	jmp	.L12
.L27:
	movl	$0, -24(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -20(%rbp)
	jmp	.L13
.L14:
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -20(%rbp)
.L13:
	cmpl	$47, -20(%rbp)
	jle	.L14
	jmp	.L15
.L16:
	movl	-24(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	subl	$48, %eax
	addl	%eax, -24(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -20(%rbp)
.L15:
	cmpl	$47, -20(%rbp)
	jg	.L16
	movl	-24(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-28(%rbp), %eax
	andl	$127, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	cnt(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %esi
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	cnt(%rip), %rdx
	movl	%esi, (%rcx,%rdx)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L18
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40(%rbp)
	jmp	.L19
.L25:
	movl	$0, -16(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -12(%rbp)
	jmp	.L20
.L21:
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -12(%rbp)
.L20:
	cmpl	$47, -12(%rbp)
	jle	.L21
	jmp	.L22
.L23:
	movl	-16(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	subl	$48, %eax
	addl	%eax, -16(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -12(%rbp)
.L22:
	cmpl	$47, -12(%rbp)
	jg	.L23
	nop
	addl	$1, -40(%rbp)
.L19:
	movl	-40(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L25
	jmp	.L11
.L18:
	addl	$1, -40(%rbp)
.L12:
	movl	-40(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L27
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L26:
.L11:
	movl	$0, -8(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
	jmp	.L28
.L29:
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
.L28:
	cmpl	$47, -4(%rbp)
	jle	.L29
	jmp	.L30
.L31:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -8(%rbp)
	movl	-4(%rbp), %eax
	subl	$48, %eax
	addl	%eax, -8(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
.L30:
	cmpl	$47, -4(%rbp)
	jg	.L31
	movl	-8(%rbp), %eax
	movl	%eax, -36(%rbp)
	cmpl	$0, -36(%rbp)
	jne	.L33
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	buffer
	.bss
	.align 32
	.type	buffer, @object
	.size	buffer, 4194304
buffer:
	.zero	4194304
	.globl	pos
	.align 4
	.type	pos, @object
	.size	pos, 4
pos:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.text
	.globl	mygetchar
	.type	mygetchar, @function
mygetchar:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	pos(%rip), %edx
	movl	end(%rip), %eax
	cmpl	%eax, %edx
	jne	.L2
	movl	$4194304, %edx
	leaq	buffer(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	movl	$0, %eax
	call	read@PLT
	movl	%eax, end(%rip)
	movl	$0, pos(%rip)
.L2:
	movl	pos(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, pos(%rip)
	cltq
	leaq	buffer(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	mygetchar, .-mygetchar
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
	jmp	.L5
.L6:
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
.L5:
	cmpl	$47, -4(%rbp)
	jle	.L6
	jmp	.L7
.L8:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -8(%rbp)
	movl	-4(%rbp), %eax
	subl	$48, %eax
	addl	%eax, -8(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
.L7:
	cmpl	$47, -4(%rbp)
	jg	.L8
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	getInt, .-getInt
	.globl	cnt
	.bss
	.align 32
	.type	cnt, @object
	.size	cnt, 508
cnt:
	.zero	508
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"NO COLOR"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	jmp	.L11
.L33:
	movl	-36(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -32(%rbp)
	movl	$508, %edx
	movl	$0, %esi
	leaq	cnt(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -40(%rbp)
	jmp	.L12
.L27:
	movl	$0, -24(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -20(%rbp)
	jmp	.L13
.L14:
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -20(%rbp)
.L13:
	cmpl	$47, -20(%rbp)
	jle	.L14
	jmp	.L15
.L16:
	movl	-24(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	subl	$48, %eax
	addl	%eax, -24(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -20(%rbp)
.L15:
	cmpl	$47, -20(%rbp)
	jg	.L16
	movl	-24(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-28(%rbp), %eax
	andl	$127, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	cnt(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %esi
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	cnt(%rip), %rdx
	movl	%esi, (%rcx,%rdx)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L18
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40(%rbp)
	jmp	.L19
.L25:
	movl	$0, -16(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -12(%rbp)
	jmp	.L20
.L21:
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -12(%rbp)
.L20:
	cmpl	$47, -12(%rbp)
	jle	.L21
	jmp	.L22
.L23:
	movl	-16(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	subl	$48, %eax
	addl	%eax, -16(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -12(%rbp)
.L22:
	cmpl	$47, -12(%rbp)
	jg	.L23
	nop
	addl	$1, -40(%rbp)
.L19:
	movl	-40(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L25
	jmp	.L11
.L18:
	addl	$1, -40(%rbp)
.L12:
	movl	-40(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L27
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L26:
.L11:
	movl	$0, -8(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
	jmp	.L28
.L29:
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
.L28:
	cmpl	$47, -4(%rbp)
	jle	.L29
	jmp	.L30
.L31:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, -8(%rbp)
	movl	-4(%rbp), %eax
	subl	$48, %eax
	addl	%eax, -8(%rbp)
	movl	$0, %eax
	call	mygetchar
	movl	%eax, -4(%rbp)
.L30:
	cmpl	$47, -4(%rbp)
	jg	.L31
	movl	-8(%rbp), %eax
	movl	%eax, -36(%rbp)
	cmpl	$0, -36(%rbp)
	jne	.L33
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
