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

```c
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }

void rsort_u32(void *base, const int count){
	typedef uint32_t rsort_t;
	rsort_t *a=base;
	rsort_t *b=malloc(count*sizeof(rsort_t));
	int c[0x100];
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(0<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(0<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(1<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(1<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(2<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(2<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(3<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(3<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	free(b);
}

int b[100001];
int main(void){
	int n=nextint();
	int m=nextint();
	int a=0;
	for(int i=1; i<=n; i++){
		a=(a+nextint())%m;
		b[i]=a;
	}
	rsort_u32(b, n+1);
	long ans=0;
	int s=1;
	for(int i=1; i<=n; i++){
		if(b[i]==b[i-1]){
			ans+=s;
			s++;
		}else{
			s=1;
		}
	}
	printf("%ld\n", ans);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	nextint
	.type	nextint, @function
nextint:
.LFB6:
	.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
	call	getchar_unlocked@PLT
	movb	%al, -6(%rbp)
	jmp	.L2
.L4:
	call	getchar_unlocked@PLT
	movb	%al, -6(%rbp)
.L2:
	cmpb	$45, -6(%rbp)
	je	.L3
	cmpb	$47, -6(%rbp)
	jle	.L4
	cmpb	$57, -6(%rbp)
	jg	.L4
.L3:
	movb	$0, -5(%rbp)
	cmpb	$45, -6(%rbp)
	jne	.L5
	movb	$1, -5(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -6(%rbp)
.L5:
	movl	$0, -4(%rbp)
	jmp	.L6
.L8:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movsbl	-6(%rbp), %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, -4(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -6(%rbp)
.L6:
	cmpb	$47, -6(%rbp)
	jle	.L7
	cmpb	$57, -6(%rbp)
	jle	.L8
.L7:
	cmpb	$0, -5(%rbp)
	je	.L9
	movl	-4(%rbp), %eax
	negl	%eax
	jmp	.L11
.L9:
	movl	-4(%rbp), %eax
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	nextint, .-nextint
	.globl	nextlong
	.type	nextlong, @function
nextlong:
.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
	call	getchar_unlocked@PLT
	movb	%al, -13(%rbp)
	jmp	.L13
.L15:
	call	getchar_unlocked@PLT
	movb	%al, -13(%rbp)
.L13:
	cmpb	$45, -13(%rbp)
	je	.L14
	cmpb	$47, -13(%rbp)
	jle	.L15
	cmpb	$57, -13(%rbp)
	jg	.L15
.L14:
	movl	$0, -12(%rbp)
	cmpb	$45, -13(%rbp)
	jne	.L16
	movl	$1, -12(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -13(%rbp)
.L16:
	movq	$0, -8(%rbp)
	jmp	.L17
.L19:
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movsbq	-13(%rbp), %rax
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -8(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -13(%rbp)
.L17:
	cmpb	$47, -13(%rbp)
	jle	.L18
	cmpb	$57, -13(%rbp)
	jle	.L19
.L18:
	cmpl	$0, -12(%rbp)
	je	.L20
	movq	-8(%rbp), %rax
	negq	%rax
	jmp	.L22
.L20:
	movq	-8(%rbp), %rax
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	nextlong, .-nextlong
	.globl	nextstr
	.type	nextstr, @function
nextstr:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -5(%rbp)
	jmp	.L24
.L25:
	call	getchar_unlocked@PLT
	movb	%al, -5(%rbp)
.L24:
	cmpb	$32, -5(%rbp)
	je	.L25
	cmpb	$10, -5(%rbp)
	je	.L25
	movl	$0, -4(%rbp)
	jmp	.L26
.L28:
	movq	-24(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -24(%rbp)
	movzbl	-5(%rbp), %edx
	movb	%dl, (%rax)
	addl	$1, -4(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -5(%rbp)
.L26:
	cmpb	$32, -5(%rbp)
	je	.L27
	cmpb	$10, -5(%rbp)
	jne	.L28
.L27:
	movq	-24(%rbp), %rax
	movb	$0, (%rax)
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	nextstr, .-nextstr
	.globl	rsort_u32
	.type	rsort_u32, @function
rsort_u32:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1152, %rsp
	movq	%rdi, -1144(%rbp)
	movl	%esi, -1148(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	-1144(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movl	-1148(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -1080(%rbp)
	leaq	-1040(%rbp), %rax
	movl	$1024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1136(%rbp)
	jmp	.L31
.L32:
	movl	-1136(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movzbl	%al, %edx
	movl	%edx, %eax
	movl	-1040(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%edx, %edx
	movl	%eax, -1040(%rbp,%rdx,4)
	addl	$1, -1136(%rbp)
.L31:
	movl	-1136(%rbp), %eax
	cmpl	-1148(%rbp), %eax
	jl	.L32
	movl	$1, -1132(%rbp)
	jmp	.L33
.L34:
	movl	-1132(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %edx
	movl	-1132(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1132(%rbp), %eax
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1132(%rbp)
.L33:
	cmpl	$255, -1132(%rbp)
	jle	.L34
	movl	-1148(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1128(%rbp)
	jmp	.L35
.L36:
	movl	-1128(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-1128(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movzbl	%al, %eax
	movl	%eax, %edx
	movl	-1040(%rbp,%rdx,4), %edx
	subl	$1, %edx
	movl	%eax, %esi
	movl	%edx, -1040(%rbp,%rsi,4)
	movl	%eax, %eax
	movl	-1040(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1080(%rbp), %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	subl	$1, -1128(%rbp)
.L35:
	cmpl	$0, -1128(%rbp)
	jns	.L36
	movq	-1088(%rbp), %rax
	movq	%rax, -1072(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movq	-1072(%rbp), %rax
	movq	%rax, -1080(%rbp)
	leaq	-1040(%rbp), %rax
	movl	$1024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1124(%rbp)
	jmp	.L37
.L38:
	movl	-1124(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$8, %eax
	movzbl	%al, %edx
	movl	%edx, %eax
	movl	-1040(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%edx, %edx
	movl	%eax, -1040(%rbp,%rdx,4)
	addl	$1, -1124(%rbp)
.L37:
	movl	-1124(%rbp), %eax
	cmpl	-1148(%rbp), %eax
	jl	.L38
	movl	$1, -1120(%rbp)
	jmp	.L39
.L40:
	movl	-1120(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %edx
	movl	-1120(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1120(%rbp), %eax
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1120(%rbp)
.L39:
	cmpl	$255, -1120(%rbp)
	jle	.L40
	movl	-1148(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1116(%rbp)
	jmp	.L41
.L42:
	movl	-1116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-1116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$8, %eax
	movzbl	%al, %eax
	movl	%eax, %edx
	movl	-1040(%rbp,%rdx,4), %edx
	subl	$1, %edx
	movl	%eax, %esi
	movl	%edx, -1040(%rbp,%rsi,4)
	movl	%eax, %eax
	movl	-1040(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1080(%rbp), %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	subl	$1, -1116(%rbp)
.L41:
	cmpl	$0, -1116(%rbp)
	jns	.L42
	movq	-1088(%rbp), %rax
	movq	%rax, -1064(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movq	-1064(%rbp), %rax
	movq	%rax, -1080(%rbp)
	leaq	-1040(%rbp), %rax
	movl	$1024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1112(%rbp)
	jmp	.L43
.L44:
	movl	-1112(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$16, %eax
	movzbl	%al, %edx
	movl	%edx, %eax
	movl	-1040(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%edx, %edx
	movl	%eax, -1040(%rbp,%rdx,4)
	addl	$1, -1112(%rbp)
.L43:
	movl	-1112(%rbp), %eax
	cmpl	-1148(%rbp), %eax
	jl	.L44
	movl	$1, -1108(%rbp)
	jmp	.L45
.L46:
	movl	-1108(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %edx
	movl	-1108(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1108(%rbp), %eax
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1108(%rbp)
.L45:
	cmpl	$255, -1108(%rbp)
	jle	.L46
	movl	-1148(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1104(%rbp)
	jmp	.L47
.L48:
	movl	-1104(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-1104(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$16, %eax
	movzbl	%al, %eax
	movl	%eax, %edx
	movl	-1040(%rbp,%rdx,4), %edx
	subl	$1, %edx
	movl	%eax, %esi
	movl	%edx, -1040(%rbp,%rsi,4)
	movl	%eax, %eax
	movl	-1040(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1080(%rbp), %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	subl	$1, -1104(%rbp)
.L47:
	cmpl	$0, -1104(%rbp)
	jns	.L48
	movq	-1088(%rbp), %rax
	movq	%rax, -1056(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movq	-1056(%rbp), %rax
	movq	%rax, -1080(%rbp)
	leaq	-1040(%rbp), %rax
	movl	$1024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1100(%rbp)
	jmp	.L49
.L50:
	movl	-1100(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$24, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	movl	-1040(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%edx, %edx
	movl	%eax, -1040(%rbp,%rdx,4)
	addl	$1, -1100(%rbp)
.L49:
	movl	-1100(%rbp), %eax
	cmpl	-1148(%rbp), %eax
	jl	.L50
	movl	$1, -1096(%rbp)
	jmp	.L51
.L52:
	movl	-1096(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %edx
	movl	-1096(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1096(%rbp), %eax
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1096(%rbp)
.L51:
	cmpl	$255, -1096(%rbp)
	jle	.L52
	movl	-1148(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1092(%rbp)
	jmp	.L53
.L54:
	movl	-1092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-1092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$24, %eax
	movl	%eax, %edx
	movl	-1040(%rbp,%rdx,4), %edx
	subl	$1, %edx
	movl	%eax, %esi
	movl	%edx, -1040(%rbp,%rsi,4)
	movl	%eax, %eax
	movl	-1040(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1080(%rbp), %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	subl	$1, -1092(%rbp)
.L53:
	cmpl	$0, -1092(%rbp)
	jns	.L54
	movq	-1088(%rbp), %rax
	movq	%rax, -1048(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movq	-1048(%rbp), %rax
	movq	%rax, -1080(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L55
	call	__stack_chk_fail@PLT
.L55:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	rsort_u32, .-rsort_u32
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 400004
b:
	.zero	400004
	.section	.rodata
.LC0:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	call	nextint
	movl	%eax, -16(%rbp)
	call	nextint
	movl	%eax, -12(%rbp)
	movl	$0, -32(%rbp)
	movl	$1, -28(%rbp)
	jmp	.L57
.L58:
	call	nextint
	movl	-32(%rbp), %edx
	addl	%edx, %eax
	cltd
	idivl	-12(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -28(%rbp)
.L57:
	movl	-28(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jle	.L58
	movl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	b(%rip), %rax
	movq	%rax, %rdi
	call	rsort_u32
	movq	$0, -8(%rbp)
	movl	$1, -24(%rbp)
	movl	$1, -20(%rbp)
	jmp	.L59
.L62:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L60
	movl	-24(%rbp), %eax
	cltq
	addq	%rax, -8(%rbp)
	addl	$1, -24(%rbp)
	jmp	.L61
.L60:
	movl	$1, -24(%rbp)
.L61:
	addl	$1, -20(%rbp)
.L59:
	movl	-20(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jle	.L62
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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	nextint
	.type	nextint, @function
nextint:
.LFB63:
	.cfi_startproc
	endbr64
	movq	stdin(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L44
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
	movl	%eax, %ecx
.L3:
	movl	%eax, %edx
	subl	$48, %ecx
	cmpb	$45, %al
	je	.L9
	cmpb	$9, %cl
	jbe	.L4
.L41:
	movq	stdin(%rip), %rdi
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	leal	-48(%rdx), %ecx
	cmpb	$45, %dl
	je	.L9
	cmpb	$9, %cl
	jbe	.L4
.L8:
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jb	.L5
	call	__uflow@PLT
	leal	-48(%rax), %ecx
	movl	%eax, %edx
	cmpb	$9, %cl
	jbe	.L4
	cmpb	$45, %al
	jne	.L41
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$45, %dl
	je	.L9
	xorl	%r12d, %r12d
	cmpb	$9, %cl
	ja	.L22
.L10:
	xorl	%ebx, %ebx
.L42:
	movq	stdin(%rip), %rdi
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L15:
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	leal	-48(%rdx), %eax
	cmpb	$9, %al
	ja	.L17
.L18:
	leal	(%rbx,%rbx,4), %eax
	movsbl	%dl, %edx
	leal	(%rdx,%rax,2), %ebp
	movq	8(%rdi), %rax
	leal	-48(%rbp), %ebx
	cmpq	16(%rdi), %rax
	jb	.L15
	call	__uflow@PLT
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L42
.L17:
	movl	$48, %eax
	subl	%ebp, %eax
	testb	%r12b, %r12b
	cmove	%ebx, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L45
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	movl	%edx, %eax
.L13:
	subl	$48, %eax
	cmpb	$9, %al
	ja	.L22
	movl	$1, %r12d
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L22:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L44:
	.cfi_restore_state
	call	__uflow@PLT
	movl	%eax, %ecx
	jmp	.L3
.L45:
	call	__uflow@PLT
	movl	%eax, %edx
	jmp	.L13
	.cfi_endproc
.LFE63:
	.size	nextint, .-nextint
	.p2align 4
	.globl	nextlong
	.type	nextlong, @function
nextlong:
.LFB64:
	.cfi_startproc
	endbr64
	movq	stdin(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L88
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
	movl	%eax, %ecx
.L48:
	movl	%eax, %edx
	subl	$48, %ecx
	cmpb	$45, %al
	je	.L54
	cmpb	$9, %cl
	jbe	.L49
.L86:
	movq	stdin(%rip), %rdi
	jmp	.L53
	.p2align 4,,10
	.p2align 3
.L50:
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	leal	-48(%rdx), %ecx
	cmpb	$45, %dl
	je	.L54
	cmpb	$9, %cl
	jbe	.L49
.L53:
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jb	.L50
	call	__uflow@PLT
	leal	-48(%rax), %ecx
	movl	%eax, %edx
	cmpb	$9, %cl
	jbe	.L49
	cmpb	$45, %al
	jne	.L86
	.p2align 4,,10
	.p2align 3
.L49:
	cmpb	$45, %dl
	je	.L54
	xorl	%r12d, %r12d
	cmpb	$9, %cl
	ja	.L67
.L55:
	xorl	%ebx, %ebx
.L87:
	movq	stdin(%rip), %rdi
	jmp	.L63
	.p2align 4,,10
	.p2align 3
.L60:
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	leal	-48(%rdx), %eax
	cmpb	$9, %al
	ja	.L62
.L63:
	leaq	(%rbx,%rbx,4), %rax
	movsbq	%dl, %rdx
	leaq	(%rdx,%rax,2), %rbp
	movq	8(%rdi), %rax
	leaq	-48(%rbp), %rbx
	cmpq	16(%rdi), %rax
	jb	.L60
	call	__uflow@PLT
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L87
.L62:
	movl	$48, %eax
	subq	%rbp, %rax
	testl	%r12d, %r12d
	cmove	%rbx, %rax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L54:
	.cfi_restore_state
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L89
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	movl	%edx, %eax
.L58:
	subl	$48, %eax
	cmpb	$9, %al
	ja	.L67
	movl	$1, %r12d
	jmp	.L55
	.p2align 4,,10
	.p2align 3
.L67:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L88:
	.cfi_restore_state
	call	__uflow@PLT
	movl	%eax, %ecx
	jmp	.L48
.L89:
	call	__uflow@PLT
	movl	%eax, %edx
	jmp	.L58
	.cfi_endproc
.LFE64:
	.size	nextlong, .-nextlong
	.p2align 4
	.globl	nextstr
	.type	nextstr, @function
nextstr:
.LFB65:
	.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
	movq	%rdi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L123
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L122:
	movl	%eax, %edx
	cmpb	$10, %al
	je	.L94
	cmpb	$32, %al
	jne	.L93
.L94:
	movq	stdin(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L98:
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L123
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	cmpb	$32, %dl
	je	.L98
	cmpb	$10, %dl
	je	.L98
.L93:
	xorl	%r12d, %r12d
	jmp	.L104
	.p2align 4,,10
	.p2align 3
.L99:
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	cmpb	$32, %dl
	je	.L102
	cmpb	$10, %dl
	je	.L102
.L104:
	movb	%dl, (%rbx)
	movq	stdin(%rip), %rdi
	addq	$1, %rbx
	addl	$1, %r12d
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jb	.L99
	call	__uflow@PLT
	movl	%eax, %edx
	cmpb	$10, %al
	je	.L102
	cmpb	$32, %al
	jne	.L104
.L102:
	movb	$0, (%rbx)
	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
.L123:
	.cfi_restore_state
	call	__uflow@PLT
	jmp	.L122
	.cfi_endproc
.LFE65:
	.size	nextstr, .-nextstr
	.p2align 4
	.globl	rsort_u32
	.type	rsort_u32, @function
rsort_u32:
.LFB66:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	movslq	%esi, %rdi
	movq	%rdi, %rbp
	salq	$2, %rdi
	subq	$1048, %rsp
	.cfi_def_cfa_offset 1072
	movq	%fs:40, %rax
	movq	%rax, 1032(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movq	%rsp, %r10
	movl	$128, %ecx
	leal	-1(%rbp), %r8d
	movq	%rax, %r9
	movq	%r10, %rdi
	xorl	%eax, %eax
	rep stosq
	testl	%ebp, %ebp
	jle	.L125
	leal	-1(%rbp), %edx
	movq	%rbx, %rax
	movq	%rdx, %r8
	leaq	4(%rbx,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L126:
	movzbl	(%rax), %edx
	addq	$4, %rax
	addl	$1, (%rsp,%rdx,4)
	cmpq	%rax, %rcx
	jne	.L126
.L125:
	leaq	4(%rsp), %rdx
	movl	(%rsp), %ecx
	leaq	1024(%rsp), %rsi
	movq	%rdx, %rax
	.p2align 4,,10
	.p2align 3
.L127:
	addl	(%rax), %ecx
	addq	$4, %rax
	movl	%ecx, -4(%rax)
	cmpq	%rax, %rsi
	jne	.L127
	testl	%r8d, %r8d
	js	.L128
	movslq	%r8d, %rcx
	.p2align 4,,10
	.p2align 3
.L129:
	movl	(%rbx,%rcx,4), %edi
	subq	$1, %rcx
	movzbl	%dil, %r11d
	movl	(%rsp,%r11,4), %eax
	subl	$1, %eax
	movl	%eax, (%rsp,%r11,4)
	cltq
	movl	%edi, (%r9,%rax,4)
	testl	%ecx, %ecx
	jns	.L129
.L128:
	movl	$128, %ecx
	xorl	%eax, %eax
	movq	%r10, %rdi
	rep stosq
	testl	%ebp, %ebp
	jle	.L130
	movl	%ebp, %eax
	movq	%r9, %rcx
	leaq	(%r9,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L131:
	movl	(%rcx), %eax
	addq	$4, %rcx
	movzbl	%ah, %eax
	movl	%eax, %eax
	addl	$1, (%rsp,%rax,4)
	cmpq	%rcx, %rdi
	jne	.L131
.L130:
	movl	(%rsp), %ecx
	movq	%rdx, %rax
	.p2align 4,,10
	.p2align 3
.L132:
	addl	(%rax), %ecx
	addq	$4, %rax
	movl	%ecx, -4(%rax)
	cmpq	%rax, %rsi
	jne	.L132
	testl	%r8d, %r8d
	js	.L133
	movslq	%r8d, %rdi
	.p2align 4,,10
	.p2align 3
.L134:
	movl	(%r9,%rdi,4), %r11d
	subq	$1, %rdi
	movl	%r11d, %eax
	movzbl	%ah, %ecx
	movl	%ecx, %ecx
	movl	(%rsp,%rcx,4), %eax
	subl	$1, %eax
	movl	%eax, (%rsp,%rcx,4)
	cltq
	movl	%r11d, (%rbx,%rax,4)
	testl	%edi, %edi
	jns	.L134
.L133:
	movl	$128, %ecx
	xorl	%eax, %eax
	movq	%r10, %rdi
	rep stosq
	testl	%ebp, %ebp
	jle	.L135
	movl	%r8d, %ecx
	movq	%rbx, %rax
	leaq	4(%rbx,%rcx,4), %rdi
	.p2align 4,,10
	.p2align 3
.L136:
	movzbl	2(%rax), %ecx
	addq	$4, %rax
	addl	$1, (%rsp,%rcx,4)
	cmpq	%rax, %rdi
	jne	.L136
.L135:
	movl	(%rsp), %ecx
	movq	%rdx, %rax
	.p2align 4,,10
	.p2align 3
.L137:
	addl	(%rax), %ecx
	addq	$4, %rax
	movl	%ecx, -4(%rax)
	cmpq	%rax, %rsi
	jne	.L137
	testl	%r8d, %r8d
	js	.L138
	movslq	%r8d, %rdi
	.p2align 4,,10
	.p2align 3
.L139:
	movl	(%rbx,%rdi,4), %r11d
	subq	$1, %rdi
	movl	%r11d, %ecx
	shrl	$16, %ecx
	movzbl	%cl, %ecx
	movl	(%rsp,%rcx,4), %eax
	subl	$1, %eax
	movl	%eax, (%rsp,%rcx,4)
	cltq
	movl	%r11d, (%r9,%rax,4)
	testl	%edi, %edi
	jns	.L139
.L138:
	movl	$128, %ecx
	xorl	%eax, %eax
	movq	%r10, %rdi
	rep stosq
	testl	%ebp, %ebp
	jle	.L140
	movl	%ebp, %ebp
	movq	%r9, %rcx
	leaq	(%r9,%rbp,4), %rdi
	.p2align 4,,10
	.p2align 3
.L141:
	movl	(%rcx), %eax
	addq	$4, %rcx
	shrl	$24, %eax
	addl	$1, (%rsp,%rax,4)
	cmpq	%rcx, %rdi
	jne	.L141
.L140:
	movl	(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L142:
	addl	(%rdx), %eax
	addq	$4, %rdx
	movl	%eax, -4(%rdx)
	cmpq	%rdx, %rsi
	jne	.L142
	testl	%r8d, %r8d
	js	.L143
	movslq	%r8d, %r8
	.p2align 4,,10
	.p2align 3
.L144:
	movl	(%r9,%r8,4), %ecx
	subq	$1, %r8
	movl	%ecx, %edx
	shrl	$24, %edx
	movl	(%rsp,%rdx,4), %eax
	subl	$1, %eax
	movl	%eax, (%rsp,%rdx,4)
	cltq
	movl	%ecx, (%rbx,%rax,4)
	testl	%r8d, %r8d
	jns	.L144
.L143:
	movq	1032(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L162
	addq	$1048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movq	%r9, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	free@PLT
.L162:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE66:
	.size	rsort_u32, .-rsort_u32
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB67:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	nextint
	movl	%eax, %ebx
	call	nextint
	testl	%ebx, %ebx
	jle	.L164
	movl	%eax, %r12d
	movl	$1, %ebp
	xorl	%r13d, %r13d
	leaq	b(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L165:
	call	nextint
	addl	%r13d, %eax
	cltd
	idivl	%r12d
	movl	%edx, (%r14,%rbp,4)
	addq	$1, %rbp
	movl	%edx, %r13d
	cmpl	%ebp, %ebx
	jge	.L165
	leal	1(%rbx), %esi
	movq	%r14, %rdi
	call	rsort_u32
	cmpl	$2, %ebx
	jle	.L184
	leal	-3(%rbx), %eax
	leaq	-8+b(%rip), %r10
	movl	(%r14), %edi
	xorl	%r8d, %r8d
	shrl	%eax
	movl	$3, %esi
	leaq	4(%r10), %rcx
	movl	$1, %edx
	leaq	5(%rax,%rax), %r11
.L169:
	movl	(%r10,%rsi,4), %eax
	movl	$1, %r9d
	cmpl	%eax, %edi
	jne	.L167
	movslq	%edx, %rdi
	leal	1(%rdx), %r9d
	addq	%rdi, %r8
.L167:
	movl	(%rcx,%rsi,4), %edi
	movl	$1, %edx
	cmpl	%edi, %eax
	jne	.L168
	movslq	%r9d, %rax
	leal	1(%r9), %edx
	addq	%rax, %r8
.L168:
	movslq	%esi, %rax
	addq	$2, %rsi
	cmpq	%r11, %rsi
	jne	.L169
	jmp	.L171
	.p2align 4,,10
	.p2align 3
.L177:
	addq	$1, %rax
	movl	$1, %edx
	cmpl	%eax, %ebx
	jl	.L172
.L171:
	movl	(%r14,%rax,4), %edi
	cmpl	%edi, (%rcx,%rax,4)
	jne	.L177
	movslq	%edx, %rsi
	addq	$1, %rax
	addl	$1, %edx
	addq	%rsi, %r8
	cmpl	%eax, %ebx
	jge	.L171
.L172:
	movq	%r8, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L164:
	.cfi_restore_state
	leal	1(%rbx), %esi
	leaq	b(%rip), %rdi
	call	rsort_u32
	xorl	%r8d, %r8d
	jmp	.L172
.L184:
	movl	$1, %eax
	movl	$1, %edx
	xorl	%r8d, %r8d
	leaq	-4+b(%rip), %rcx
	jmp	.L171
	.cfi_endproc
.LFE67:
	.size	main, .-main
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 400004
b:
	.zero	400004
	.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	nextint
	.type	nextint, @function
nextint:
.LFB63:
	.cfi_startproc
	endbr64
	movq	stdin(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L44
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
	movl	%eax, %ecx
.L3:
	movl	%eax, %edx
	subl	$48, %ecx
	cmpb	$45, %al
	je	.L9
	cmpb	$9, %cl
	jbe	.L4
.L41:
	movq	stdin(%rip), %rdi
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	leal	-48(%rdx), %ecx
	cmpb	$45, %dl
	je	.L9
	cmpb	$9, %cl
	jbe	.L4
.L8:
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jb	.L5
	call	__uflow@PLT
	leal	-48(%rax), %ecx
	movl	%eax, %edx
	cmpb	$9, %cl
	jbe	.L4
	cmpb	$45, %al
	jne	.L41
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$45, %dl
	je	.L9
	xorl	%r12d, %r12d
	cmpb	$9, %cl
	ja	.L22
.L10:
	xorl	%ebx, %ebx
.L42:
	movq	stdin(%rip), %rdi
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L15:
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	leal	-48(%rdx), %eax
	cmpb	$9, %al
	ja	.L17
.L18:
	leal	(%rbx,%rbx,4), %eax
	movsbl	%dl, %edx
	leal	(%rdx,%rax,2), %ebp
	movq	8(%rdi), %rax
	leal	-48(%rbp), %ebx
	cmpq	16(%rdi), %rax
	jb	.L15
	call	__uflow@PLT
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L42
.L17:
	movl	$48, %eax
	subl	%ebp, %eax
	testb	%r12b, %r12b
	cmove	%ebx, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L45
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	movl	%edx, %eax
.L13:
	subl	$48, %eax
	cmpb	$9, %al
	ja	.L22
	movl	$1, %r12d
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L22:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L44:
	.cfi_restore_state
	call	__uflow@PLT
	movl	%eax, %ecx
	jmp	.L3
.L45:
	call	__uflow@PLT
	movl	%eax, %edx
	jmp	.L13
	.cfi_endproc
.LFE63:
	.size	nextint, .-nextint
	.p2align 4
	.globl	nextlong
	.type	nextlong, @function
nextlong:
.LFB64:
	.cfi_startproc
	endbr64
	movq	stdin(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L88
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
	movl	%eax, %ecx
.L48:
	movl	%eax, %edx
	subl	$48, %ecx
	cmpb	$45, %al
	je	.L54
	cmpb	$9, %cl
	jbe	.L49
.L86:
	movq	stdin(%rip), %rdi
	jmp	.L53
	.p2align 4,,10
	.p2align 3
.L50:
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	leal	-48(%rdx), %ecx
	cmpb	$45, %dl
	je	.L54
	cmpb	$9, %cl
	jbe	.L49
.L53:
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jb	.L50
	call	__uflow@PLT
	leal	-48(%rax), %ecx
	movl	%eax, %edx
	cmpb	$9, %cl
	jbe	.L49
	cmpb	$45, %al
	jne	.L86
	.p2align 4,,10
	.p2align 3
.L49:
	cmpb	$45, %dl
	je	.L54
	xorl	%r12d, %r12d
	cmpb	$9, %cl
	ja	.L67
.L55:
	xorl	%ebx, %ebx
.L87:
	movq	stdin(%rip), %rdi
	jmp	.L63
	.p2align 4,,10
	.p2align 3
.L60:
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	leal	-48(%rdx), %eax
	cmpb	$9, %al
	ja	.L62
.L63:
	leaq	(%rbx,%rbx,4), %rax
	movsbq	%dl, %rdx
	leaq	(%rdx,%rax,2), %rbp
	movq	8(%rdi), %rax
	leaq	-48(%rbp), %rbx
	cmpq	16(%rdi), %rax
	jb	.L60
	call	__uflow@PLT
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L87
.L62:
	movl	$48, %eax
	subq	%rbp, %rax
	testl	%r12d, %r12d
	cmove	%rbx, %rax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L54:
	.cfi_restore_state
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L89
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	movl	%edx, %eax
.L58:
	subl	$48, %eax
	cmpb	$9, %al
	ja	.L67
	movl	$1, %r12d
	jmp	.L55
	.p2align 4,,10
	.p2align 3
.L67:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L88:
	.cfi_restore_state
	call	__uflow@PLT
	movl	%eax, %ecx
	jmp	.L48
.L89:
	call	__uflow@PLT
	movl	%eax, %edx
	jmp	.L58
	.cfi_endproc
.LFE64:
	.size	nextlong, .-nextlong
	.p2align 4
	.globl	nextstr
	.type	nextstr, @function
nextstr:
.LFB65:
	.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
	movq	%rdi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L123
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L122:
	movl	%eax, %edx
	cmpb	$10, %al
	je	.L94
	cmpb	$32, %al
	jne	.L93
.L94:
	movq	stdin(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L98:
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L123
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	cmpb	$32, %dl
	je	.L98
	cmpb	$10, %dl
	je	.L98
.L93:
	xorl	%r12d, %r12d
	jmp	.L104
	.p2align 4,,10
	.p2align 3
.L99:
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %edx
	cmpb	$32, %dl
	je	.L102
	cmpb	$10, %dl
	je	.L102
.L104:
	movb	%dl, (%rbx)
	movq	stdin(%rip), %rdi
	addq	$1, %rbx
	addl	$1, %r12d
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jb	.L99
	call	__uflow@PLT
	movl	%eax, %edx
	cmpb	$10, %al
	je	.L102
	cmpb	$32, %al
	jne	.L104
.L102:
	movb	$0, (%rbx)
	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
.L123:
	.cfi_restore_state
	call	__uflow@PLT
	jmp	.L122
	.cfi_endproc
.LFE65:
	.size	nextstr, .-nextstr
	.p2align 4
	.globl	rsort_u32
	.type	rsort_u32, @function
rsort_u32:
.LFB66:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	movslq	%esi, %rdi
	movq	%rdi, %rbp
	salq	$2, %rdi
	subq	$1048, %rsp
	.cfi_def_cfa_offset 1072
	movq	%fs:40, %rax
	movq	%rax, 1032(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movq	%rsp, %r10
	movl	$128, %ecx
	leal	-1(%rbp), %r8d
	movq	%rax, %r9
	movq	%r10, %rdi
	xorl	%eax, %eax
	rep stosq
	testl	%ebp, %ebp
	jle	.L125
	leal	-1(%rbp), %edx
	movq	%rbx, %rax
	movq	%rdx, %r8
	leaq	4(%rbx,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L126:
	movzbl	(%rax), %edx
	addq	$4, %rax
	addl	$1, (%rsp,%rdx,4)
	cmpq	%rax, %rcx
	jne	.L126
.L125:
	leaq	4(%rsp), %rdx
	movl	(%rsp), %ecx
	leaq	1024(%rsp), %rsi
	movq	%rdx, %rax
	.p2align 4,,10
	.p2align 3
.L127:
	addl	(%rax), %ecx
	addq	$4, %rax
	movl	%ecx, -4(%rax)
	cmpq	%rax, %rsi
	jne	.L127
	testl	%r8d, %r8d
	js	.L128
	movslq	%r8d, %rcx
	.p2align 4,,10
	.p2align 3
.L129:
	movl	(%rbx,%rcx,4), %edi
	subq	$1, %rcx
	movzbl	%dil, %r11d
	movl	(%rsp,%r11,4), %eax
	subl	$1, %eax
	movl	%eax, (%rsp,%r11,4)
	cltq
	movl	%edi, (%r9,%rax,4)
	testl	%ecx, %ecx
	jns	.L129
.L128:
	movl	$128, %ecx
	xorl	%eax, %eax
	movq	%r10, %rdi
	rep stosq
	testl	%ebp, %ebp
	jle	.L130
	movl	%ebp, %eax
	movq	%r9, %rcx
	leaq	(%r9,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L131:
	movl	(%rcx), %eax
	addq	$4, %rcx
	movzbl	%ah, %eax
	movl	%eax, %eax
	addl	$1, (%rsp,%rax,4)
	cmpq	%rcx, %rdi
	jne	.L131
.L130:
	movl	(%rsp), %ecx
	movq	%rdx, %rax
	.p2align 4,,10
	.p2align 3
.L132:
	addl	(%rax), %ecx
	addq	$4, %rax
	movl	%ecx, -4(%rax)
	cmpq	%rax, %rsi
	jne	.L132
	testl	%r8d, %r8d
	js	.L133
	movslq	%r8d, %rdi
	.p2align 4,,10
	.p2align 3
.L134:
	movl	(%r9,%rdi,4), %r11d
	subq	$1, %rdi
	movl	%r11d, %eax
	movzbl	%ah, %ecx
	movl	%ecx, %ecx
	movl	(%rsp,%rcx,4), %eax
	subl	$1, %eax
	movl	%eax, (%rsp,%rcx,4)
	cltq
	movl	%r11d, (%rbx,%rax,4)
	testl	%edi, %edi
	jns	.L134
.L133:
	movl	$128, %ecx
	xorl	%eax, %eax
	movq	%r10, %rdi
	rep stosq
	testl	%ebp, %ebp
	jle	.L135
	movl	%r8d, %ecx
	movq	%rbx, %rax
	leaq	4(%rbx,%rcx,4), %rdi
	.p2align 4,,10
	.p2align 3
.L136:
	movzbl	2(%rax), %ecx
	addq	$4, %rax
	addl	$1, (%rsp,%rcx,4)
	cmpq	%rax, %rdi
	jne	.L136
.L135:
	movl	(%rsp), %ecx
	movq	%rdx, %rax
	.p2align 4,,10
	.p2align 3
.L137:
	addl	(%rax), %ecx
	addq	$4, %rax
	movl	%ecx, -4(%rax)
	cmpq	%rax, %rsi
	jne	.L137
	testl	%r8d, %r8d
	js	.L138
	movslq	%r8d, %rdi
	.p2align 4,,10
	.p2align 3
.L139:
	movl	(%rbx,%rdi,4), %r11d
	subq	$1, %rdi
	movl	%r11d, %ecx
	shrl	$16, %ecx
	movzbl	%cl, %ecx
	movl	(%rsp,%rcx,4), %eax
	subl	$1, %eax
	movl	%eax, (%rsp,%rcx,4)
	cltq
	movl	%r11d, (%r9,%rax,4)
	testl	%edi, %edi
	jns	.L139
.L138:
	movl	$128, %ecx
	xorl	%eax, %eax
	movq	%r10, %rdi
	rep stosq
	testl	%ebp, %ebp
	jle	.L140
	movl	%ebp, %ebp
	movq	%r9, %rcx
	leaq	(%r9,%rbp,4), %rdi
	.p2align 4,,10
	.p2align 3
.L141:
	movl	(%rcx), %eax
	addq	$4, %rcx
	shrl	$24, %eax
	addl	$1, (%rsp,%rax,4)
	cmpq	%rcx, %rdi
	jne	.L141
.L140:
	movl	(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L142:
	addl	(%rdx), %eax
	addq	$4, %rdx
	movl	%eax, -4(%rdx)
	cmpq	%rdx, %rsi
	jne	.L142
	testl	%r8d, %r8d
	js	.L143
	movslq	%r8d, %r8
	.p2align 4,,10
	.p2align 3
.L144:
	movl	(%r9,%r8,4), %ecx
	subq	$1, %r8
	movl	%ecx, %edx
	shrl	$24, %edx
	movl	(%rsp,%rdx,4), %eax
	subl	$1, %eax
	movl	%eax, (%rsp,%rdx,4)
	cltq
	movl	%ecx, (%rbx,%rax,4)
	testl	%r8d, %r8d
	jns	.L144
.L143:
	movq	1032(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L162
	addq	$1048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movq	%r9, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	free@PLT
.L162:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE66:
	.size	rsort_u32, .-rsort_u32
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB67:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	nextint
	movl	%eax, %ebx
	call	nextint
	testl	%ebx, %ebx
	jle	.L164
	movl	%eax, %r12d
	movl	$1, %ebp
	xorl	%r13d, %r13d
	leaq	b(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L165:
	call	nextint
	addl	%r13d, %eax
	cltd
	idivl	%r12d
	movl	%edx, (%r14,%rbp,4)
	addq	$1, %rbp
	movl	%edx, %r13d
	cmpl	%ebp, %ebx
	jge	.L165
	leal	1(%rbx), %esi
	movq	%r14, %rdi
	call	rsort_u32
	cmpl	$2, %ebx
	jle	.L184
	leal	-3(%rbx), %eax
	leaq	-8+b(%rip), %r10
	movl	(%r14), %edi
	xorl	%r8d, %r8d
	shrl	%eax
	movl	$3, %esi
	leaq	4(%r10), %rcx
	movl	$1, %edx
	leaq	5(%rax,%rax), %r11
.L169:
	movl	(%r10,%rsi,4), %eax
	movl	$1, %r9d
	cmpl	%eax, %edi
	jne	.L167
	movslq	%edx, %rdi
	leal	1(%rdx), %r9d
	addq	%rdi, %r8
.L167:
	movl	(%rcx,%rsi,4), %edi
	movl	$1, %edx
	cmpl	%edi, %eax
	jne	.L168
	movslq	%r9d, %rax
	leal	1(%r9), %edx
	addq	%rax, %r8
.L168:
	movslq	%esi, %rax
	addq	$2, %rsi
	cmpq	%r11, %rsi
	jne	.L169
	jmp	.L171
	.p2align 4,,10
	.p2align 3
.L177:
	addq	$1, %rax
	movl	$1, %edx
	cmpl	%eax, %ebx
	jl	.L172
.L171:
	movl	(%r14,%rax,4), %edi
	cmpl	%edi, (%rcx,%rax,4)
	jne	.L177
	movslq	%edx, %rsi
	addq	$1, %rax
	addl	$1, %edx
	addq	%rsi, %r8
	cmpl	%eax, %ebx
	jge	.L171
.L172:
	movq	%r8, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L164:
	.cfi_restore_state
	leal	1(%rbx), %esi
	leaq	b(%rip), %rdi
	call	rsort_u32
	xorl	%r8d, %r8d
	jmp	.L172
.L184:
	movl	$1, %eax
	movl	$1, %edx
	xorl	%r8d, %r8d
	leaq	-4+b(%rip), %rcx
	jmp	.L171
	.cfi_endproc
.LFE67:
	.size	main, .-main
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 400004
b:
	.zero	400004
	.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 <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }

void rsort_u32(void *base, const int count){
	typedef uint32_t rsort_t;
	rsort_t *a=base;
	rsort_t *b=malloc(count*sizeof(rsort_t));
	int c[0x100];
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(0<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(0<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(1<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(1<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(2<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(2<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(3<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(3<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	free(b);
}

int b[100001];
int main(void){
	int n=nextint();
	int m=nextint();
	int a=0;
	for(int i=1; i<=n; i++){
		a=(a+nextint())%m;
		b[i]=a;
	}
	rsort_u32(b, n+1);
	long ans=0;
	int s=1;
	for(int i=1; i<=n; i++){
		if(b[i]==b[i-1]){
			ans+=s;
			s++;
		}else{
			s=1;
		}
	}
	printf("%ld\n", ans);
}

10 400000000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000010 1000000000 1000000000
 13 17
29 7 5 7 18 51 7 13 8 55 42 9 81
 10 400000000
1000000000 1100000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000010 1000000000 1000000000
 13 17
29 7 5 3 18 51 7 13 8 55 42 9 81
 13 17
29 9 6 3 18 51 7 13 16 55 8 9 81
 13 17
29 9 6 3 34 51 7 13 16 55 8 9 81
 13 17
15 9 2 3 34 64 12 13 8 34 8 9 81
 10 400000000
1000000000 1000000010 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
 13 17
29 11 6 3 34 51 7 13 16 55 8 9 81
 13 17
15 9 2 3 34 64 7 13 8 61 8 9 81

13
 3
 7
 4
 5
 6
 9
 16
 10
 8

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

```c
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }

void rsort_u32(void *base, const int count){
	typedef uint32_t rsort_t;
	rsort_t *a=base;
	rsort_t *b=malloc(count*sizeof(rsort_t));
	int c[0x100];
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(0<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(0<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(1<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(1<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(2<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(2<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(3<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(3<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	free(b);
}

int b[100001];
int main(void){
	int n=nextint();
	int m=nextint();
	int a=0;
	for(int i=1; i<=n; i++){
		a=(a+nextint())%m;
		b[i]=a;
	}
	rsort_u32(b, n+1);
	long ans=0;
	int s=1;
	for(int i=1; i<=n; i++){
		if(b[i]==b[i-1]){
			ans+=s;
			s++;
		}else{
			s=1;
		}
	}
	printf("%ld\n", ans);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	nextint
	.type	nextint, @function
nextint:
.LFB6:
	.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
	call	getchar_unlocked@PLT
	movb	%al, -6(%rbp)
	jmp	.L2
.L4:
	call	getchar_unlocked@PLT
	movb	%al, -6(%rbp)
.L2:
	cmpb	$45, -6(%rbp)
	je	.L3
	cmpb	$47, -6(%rbp)
	jle	.L4
	cmpb	$57, -6(%rbp)
	jg	.L4
.L3:
	movb	$0, -5(%rbp)
	cmpb	$45, -6(%rbp)
	jne	.L5
	movb	$1, -5(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -6(%rbp)
.L5:
	movl	$0, -4(%rbp)
	jmp	.L6
.L8:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movsbl	-6(%rbp), %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, -4(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -6(%rbp)
.L6:
	cmpb	$47, -6(%rbp)
	jle	.L7
	cmpb	$57, -6(%rbp)
	jle	.L8
.L7:
	cmpb	$0, -5(%rbp)
	je	.L9
	movl	-4(%rbp), %eax
	negl	%eax
	jmp	.L11
.L9:
	movl	-4(%rbp), %eax
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	nextint, .-nextint
	.globl	nextlong
	.type	nextlong, @function
nextlong:
.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
	call	getchar_unlocked@PLT
	movb	%al, -13(%rbp)
	jmp	.L13
.L15:
	call	getchar_unlocked@PLT
	movb	%al, -13(%rbp)
.L13:
	cmpb	$45, -13(%rbp)
	je	.L14
	cmpb	$47, -13(%rbp)
	jle	.L15
	cmpb	$57, -13(%rbp)
	jg	.L15
.L14:
	movl	$0, -12(%rbp)
	cmpb	$45, -13(%rbp)
	jne	.L16
	movl	$1, -12(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -13(%rbp)
.L16:
	movq	$0, -8(%rbp)
	jmp	.L17
.L19:
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movsbq	-13(%rbp), %rax
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -8(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -13(%rbp)
.L17:
	cmpb	$47, -13(%rbp)
	jle	.L18
	cmpb	$57, -13(%rbp)
	jle	.L19
.L18:
	cmpl	$0, -12(%rbp)
	je	.L20
	movq	-8(%rbp), %rax
	negq	%rax
	jmp	.L22
.L20:
	movq	-8(%rbp), %rax
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	nextlong, .-nextlong
	.globl	nextstr
	.type	nextstr, @function
nextstr:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -5(%rbp)
	jmp	.L24
.L25:
	call	getchar_unlocked@PLT
	movb	%al, -5(%rbp)
.L24:
	cmpb	$32, -5(%rbp)
	je	.L25
	cmpb	$10, -5(%rbp)
	je	.L25
	movl	$0, -4(%rbp)
	jmp	.L26
.L28:
	movq	-24(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -24(%rbp)
	movzbl	-5(%rbp), %edx
	movb	%dl, (%rax)
	addl	$1, -4(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -5(%rbp)
.L26:
	cmpb	$32, -5(%rbp)
	je	.L27
	cmpb	$10, -5(%rbp)
	jne	.L28
.L27:
	movq	-24(%rbp), %rax
	movb	$0, (%rax)
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	nextstr, .-nextstr
	.globl	rsort_u32
	.type	rsort_u32, @function
rsort_u32:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1152, %rsp
	movq	%rdi, -1144(%rbp)
	movl	%esi, -1148(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	-1144(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movl	-1148(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -1080(%rbp)
	leaq	-1040(%rbp), %rax
	movl	$1024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1136(%rbp)
	jmp	.L31
.L32:
	movl	-1136(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movzbl	%al, %edx
	movl	%edx, %eax
	movl	-1040(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%edx, %edx
	movl	%eax, -1040(%rbp,%rdx,4)
	addl	$1, -1136(%rbp)
.L31:
	movl	-1136(%rbp), %eax
	cmpl	-1148(%rbp), %eax
	jl	.L32
	movl	$1, -1132(%rbp)
	jmp	.L33
.L34:
	movl	-1132(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %edx
	movl	-1132(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1132(%rbp), %eax
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1132(%rbp)
.L33:
	cmpl	$255, -1132(%rbp)
	jle	.L34
	movl	-1148(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1128(%rbp)
	jmp	.L35
.L36:
	movl	-1128(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-1128(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movzbl	%al, %eax
	movl	%eax, %edx
	movl	-1040(%rbp,%rdx,4), %edx
	subl	$1, %edx
	movl	%eax, %esi
	movl	%edx, -1040(%rbp,%rsi,4)
	movl	%eax, %eax
	movl	-1040(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1080(%rbp), %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	subl	$1, -1128(%rbp)
.L35:
	cmpl	$0, -1128(%rbp)
	jns	.L36
	movq	-1088(%rbp), %rax
	movq	%rax, -1072(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movq	-1072(%rbp), %rax
	movq	%rax, -1080(%rbp)
	leaq	-1040(%rbp), %rax
	movl	$1024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1124(%rbp)
	jmp	.L37
.L38:
	movl	-1124(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$8, %eax
	movzbl	%al, %edx
	movl	%edx, %eax
	movl	-1040(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%edx, %edx
	movl	%eax, -1040(%rbp,%rdx,4)
	addl	$1, -1124(%rbp)
.L37:
	movl	-1124(%rbp), %eax
	cmpl	-1148(%rbp), %eax
	jl	.L38
	movl	$1, -1120(%rbp)
	jmp	.L39
.L40:
	movl	-1120(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %edx
	movl	-1120(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1120(%rbp), %eax
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1120(%rbp)
.L39:
	cmpl	$255, -1120(%rbp)
	jle	.L40
	movl	-1148(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1116(%rbp)
	jmp	.L41
.L42:
	movl	-1116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-1116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$8, %eax
	movzbl	%al, %eax
	movl	%eax, %edx
	movl	-1040(%rbp,%rdx,4), %edx
	subl	$1, %edx
	movl	%eax, %esi
	movl	%edx, -1040(%rbp,%rsi,4)
	movl	%eax, %eax
	movl	-1040(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1080(%rbp), %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	subl	$1, -1116(%rbp)
.L41:
	cmpl	$0, -1116(%rbp)
	jns	.L42
	movq	-1088(%rbp), %rax
	movq	%rax, -1064(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movq	-1064(%rbp), %rax
	movq	%rax, -1080(%rbp)
	leaq	-1040(%rbp), %rax
	movl	$1024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1112(%rbp)
	jmp	.L43
.L44:
	movl	-1112(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$16, %eax
	movzbl	%al, %edx
	movl	%edx, %eax
	movl	-1040(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%edx, %edx
	movl	%eax, -1040(%rbp,%rdx,4)
	addl	$1, -1112(%rbp)
.L43:
	movl	-1112(%rbp), %eax
	cmpl	-1148(%rbp), %eax
	jl	.L44
	movl	$1, -1108(%rbp)
	jmp	.L45
.L46:
	movl	-1108(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %edx
	movl	-1108(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1108(%rbp), %eax
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1108(%rbp)
.L45:
	cmpl	$255, -1108(%rbp)
	jle	.L46
	movl	-1148(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1104(%rbp)
	jmp	.L47
.L48:
	movl	-1104(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-1104(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$16, %eax
	movzbl	%al, %eax
	movl	%eax, %edx
	movl	-1040(%rbp,%rdx,4), %edx
	subl	$1, %edx
	movl	%eax, %esi
	movl	%edx, -1040(%rbp,%rsi,4)
	movl	%eax, %eax
	movl	-1040(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1080(%rbp), %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	subl	$1, -1104(%rbp)
.L47:
	cmpl	$0, -1104(%rbp)
	jns	.L48
	movq	-1088(%rbp), %rax
	movq	%rax, -1056(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movq	-1056(%rbp), %rax
	movq	%rax, -1080(%rbp)
	leaq	-1040(%rbp), %rax
	movl	$1024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1100(%rbp)
	jmp	.L49
.L50:
	movl	-1100(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$24, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	movl	-1040(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%edx, %edx
	movl	%eax, -1040(%rbp,%rdx,4)
	addl	$1, -1100(%rbp)
.L49:
	movl	-1100(%rbp), %eax
	cmpl	-1148(%rbp), %eax
	jl	.L50
	movl	$1, -1096(%rbp)
	jmp	.L51
.L52:
	movl	-1096(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %edx
	movl	-1096(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1096(%rbp), %eax
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1096(%rbp)
.L51:
	cmpl	$255, -1096(%rbp)
	jle	.L52
	movl	-1148(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1092(%rbp)
	jmp	.L53
.L54:
	movl	-1092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-1092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$24, %eax
	movl	%eax, %edx
	movl	-1040(%rbp,%rdx,4), %edx
	subl	$1, %edx
	movl	%eax, %esi
	movl	%edx, -1040(%rbp,%rsi,4)
	movl	%eax, %eax
	movl	-1040(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1080(%rbp), %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	subl	$1, -1092(%rbp)
.L53:
	cmpl	$0, -1092(%rbp)
	jns	.L54
	movq	-1088(%rbp), %rax
	movq	%rax, -1048(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movq	-1048(%rbp), %rax
	movq	%rax, -1080(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L55
	call	__stack_chk_fail@PLT
.L55:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	rsort_u32, .-rsort_u32
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 400004
b:
	.zero	400004
	.section	.rodata
.LC0:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	call	nextint
	movl	%eax, -16(%rbp)
	call	nextint
	movl	%eax, -12(%rbp)
	movl	$0, -32(%rbp)
	movl	$1, -28(%rbp)
	jmp	.L57
.L58:
	call	nextint
	movl	-32(%rbp), %edx
	addl	%edx, %eax
	cltd
	idivl	-12(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -28(%rbp)
.L57:
	movl	-28(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jle	.L58
	movl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	b(%rip), %rax
	movq	%rax, %rdi
	call	rsort_u32
	movq	$0, -8(%rbp)
	movl	$1, -24(%rbp)
	movl	$1, -20(%rbp)
	jmp	.L59
.L62:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L60
	movl	-24(%rbp), %eax
	cltq
	addq	%rax, -8(%rbp)
	addl	$1, -24(%rbp)
	jmp	.L61
.L60:
	movl	$1, -24(%rbp)
.L61:
	addl	$1, -20(%rbp)
.L59:
	movl	-20(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jle	.L62
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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	nextint
	.type	nextint, @function
nextint:
.LFB6:
	.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
	call	getchar_unlocked@PLT
	movb	%al, -6(%rbp)
	jmp	.L2
.L4:
	call	getchar_unlocked@PLT
	movb	%al, -6(%rbp)
.L2:
	cmpb	$45, -6(%rbp)
	je	.L3
	cmpb	$47, -6(%rbp)
	jle	.L4
	cmpb	$57, -6(%rbp)
	jg	.L4
.L3:
	movb	$0, -5(%rbp)
	cmpb	$45, -6(%rbp)
	jne	.L5
	movb	$1, -5(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -6(%rbp)
.L5:
	movl	$0, -4(%rbp)
	jmp	.L6
.L8:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movsbl	-6(%rbp), %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, -4(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -6(%rbp)
.L6:
	cmpb	$47, -6(%rbp)
	jle	.L7
	cmpb	$57, -6(%rbp)
	jle	.L8
.L7:
	cmpb	$0, -5(%rbp)
	je	.L9
	movl	-4(%rbp), %eax
	negl	%eax
	jmp	.L11
.L9:
	movl	-4(%rbp), %eax
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	nextint, .-nextint
	.globl	nextlong
	.type	nextlong, @function
nextlong:
.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
	call	getchar_unlocked@PLT
	movb	%al, -13(%rbp)
	jmp	.L13
.L15:
	call	getchar_unlocked@PLT
	movb	%al, -13(%rbp)
.L13:
	cmpb	$45, -13(%rbp)
	je	.L14
	cmpb	$47, -13(%rbp)
	jle	.L15
	cmpb	$57, -13(%rbp)
	jg	.L15
.L14:
	movl	$0, -12(%rbp)
	cmpb	$45, -13(%rbp)
	jne	.L16
	movl	$1, -12(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -13(%rbp)
.L16:
	movq	$0, -8(%rbp)
	jmp	.L17
.L19:
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movsbq	-13(%rbp), %rax
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -8(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -13(%rbp)
.L17:
	cmpb	$47, -13(%rbp)
	jle	.L18
	cmpb	$57, -13(%rbp)
	jle	.L19
.L18:
	cmpl	$0, -12(%rbp)
	je	.L20
	movq	-8(%rbp), %rax
	negq	%rax
	jmp	.L22
.L20:
	movq	-8(%rbp), %rax
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	nextlong, .-nextlong
	.globl	nextstr
	.type	nextstr, @function
nextstr:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -5(%rbp)
	jmp	.L24
.L25:
	call	getchar_unlocked@PLT
	movb	%al, -5(%rbp)
.L24:
	cmpb	$32, -5(%rbp)
	je	.L25
	cmpb	$10, -5(%rbp)
	je	.L25
	movl	$0, -4(%rbp)
	jmp	.L26
.L28:
	movq	-24(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -24(%rbp)
	movzbl	-5(%rbp), %edx
	movb	%dl, (%rax)
	addl	$1, -4(%rbp)
	call	getchar_unlocked@PLT
	movb	%al, -5(%rbp)
.L26:
	cmpb	$32, -5(%rbp)
	je	.L27
	cmpb	$10, -5(%rbp)
	jne	.L28
.L27:
	movq	-24(%rbp), %rax
	movb	$0, (%rax)
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	nextstr, .-nextstr
	.globl	rsort_u32
	.type	rsort_u32, @function
rsort_u32:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1152, %rsp
	movq	%rdi, -1144(%rbp)
	movl	%esi, -1148(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	-1144(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movl	-1148(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -1080(%rbp)
	leaq	-1040(%rbp), %rax
	movl	$1024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1136(%rbp)
	jmp	.L31
.L32:
	movl	-1136(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movzbl	%al, %edx
	movl	%edx, %eax
	movl	-1040(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%edx, %edx
	movl	%eax, -1040(%rbp,%rdx,4)
	addl	$1, -1136(%rbp)
.L31:
	movl	-1136(%rbp), %eax
	cmpl	-1148(%rbp), %eax
	jl	.L32
	movl	$1, -1132(%rbp)
	jmp	.L33
.L34:
	movl	-1132(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %edx
	movl	-1132(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1132(%rbp), %eax
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1132(%rbp)
.L33:
	cmpl	$255, -1132(%rbp)
	jle	.L34
	movl	-1148(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1128(%rbp)
	jmp	.L35
.L36:
	movl	-1128(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-1128(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movzbl	%al, %eax
	movl	%eax, %edx
	movl	-1040(%rbp,%rdx,4), %edx
	subl	$1, %edx
	movl	%eax, %esi
	movl	%edx, -1040(%rbp,%rsi,4)
	movl	%eax, %eax
	movl	-1040(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1080(%rbp), %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	subl	$1, -1128(%rbp)
.L35:
	cmpl	$0, -1128(%rbp)
	jns	.L36
	movq	-1088(%rbp), %rax
	movq	%rax, -1072(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movq	-1072(%rbp), %rax
	movq	%rax, -1080(%rbp)
	leaq	-1040(%rbp), %rax
	movl	$1024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1124(%rbp)
	jmp	.L37
.L38:
	movl	-1124(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$8, %eax
	movzbl	%al, %edx
	movl	%edx, %eax
	movl	-1040(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%edx, %edx
	movl	%eax, -1040(%rbp,%rdx,4)
	addl	$1, -1124(%rbp)
.L37:
	movl	-1124(%rbp), %eax
	cmpl	-1148(%rbp), %eax
	jl	.L38
	movl	$1, -1120(%rbp)
	jmp	.L39
.L40:
	movl	-1120(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %edx
	movl	-1120(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1120(%rbp), %eax
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1120(%rbp)
.L39:
	cmpl	$255, -1120(%rbp)
	jle	.L40
	movl	-1148(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1116(%rbp)
	jmp	.L41
.L42:
	movl	-1116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-1116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$8, %eax
	movzbl	%al, %eax
	movl	%eax, %edx
	movl	-1040(%rbp,%rdx,4), %edx
	subl	$1, %edx
	movl	%eax, %esi
	movl	%edx, -1040(%rbp,%rsi,4)
	movl	%eax, %eax
	movl	-1040(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1080(%rbp), %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	subl	$1, -1116(%rbp)
.L41:
	cmpl	$0, -1116(%rbp)
	jns	.L42
	movq	-1088(%rbp), %rax
	movq	%rax, -1064(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movq	-1064(%rbp), %rax
	movq	%rax, -1080(%rbp)
	leaq	-1040(%rbp), %rax
	movl	$1024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1112(%rbp)
	jmp	.L43
.L44:
	movl	-1112(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$16, %eax
	movzbl	%al, %edx
	movl	%edx, %eax
	movl	-1040(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%edx, %edx
	movl	%eax, -1040(%rbp,%rdx,4)
	addl	$1, -1112(%rbp)
.L43:
	movl	-1112(%rbp), %eax
	cmpl	-1148(%rbp), %eax
	jl	.L44
	movl	$1, -1108(%rbp)
	jmp	.L45
.L46:
	movl	-1108(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %edx
	movl	-1108(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1108(%rbp), %eax
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1108(%rbp)
.L45:
	cmpl	$255, -1108(%rbp)
	jle	.L46
	movl	-1148(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1104(%rbp)
	jmp	.L47
.L48:
	movl	-1104(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-1104(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$16, %eax
	movzbl	%al, %eax
	movl	%eax, %edx
	movl	-1040(%rbp,%rdx,4), %edx
	subl	$1, %edx
	movl	%eax, %esi
	movl	%edx, -1040(%rbp,%rsi,4)
	movl	%eax, %eax
	movl	-1040(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1080(%rbp), %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	subl	$1, -1104(%rbp)
.L47:
	cmpl	$0, -1104(%rbp)
	jns	.L48
	movq	-1088(%rbp), %rax
	movq	%rax, -1056(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movq	-1056(%rbp), %rax
	movq	%rax, -1080(%rbp)
	leaq	-1040(%rbp), %rax
	movl	$1024, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1100(%rbp)
	jmp	.L49
.L50:
	movl	-1100(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$24, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	movl	-1040(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%edx, %edx
	movl	%eax, -1040(%rbp,%rdx,4)
	addl	$1, -1100(%rbp)
.L49:
	movl	-1100(%rbp), %eax
	cmpl	-1148(%rbp), %eax
	jl	.L50
	movl	$1, -1096(%rbp)
	jmp	.L51
.L52:
	movl	-1096(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %edx
	movl	-1096(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1096(%rbp), %eax
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1096(%rbp)
.L51:
	cmpl	$255, -1096(%rbp)
	jle	.L52
	movl	-1148(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1092(%rbp)
	jmp	.L53
.L54:
	movl	-1092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-1092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1088(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	shrl	$24, %eax
	movl	%eax, %edx
	movl	-1040(%rbp,%rdx,4), %edx
	subl	$1, %edx
	movl	%eax, %esi
	movl	%edx, -1040(%rbp,%rsi,4)
	movl	%eax, %eax
	movl	-1040(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-1080(%rbp), %rax
	addq	%rax, %rdx
	movl	(%rcx), %eax
	movl	%eax, (%rdx)
	subl	$1, -1092(%rbp)
.L53:
	cmpl	$0, -1092(%rbp)
	jns	.L54
	movq	-1088(%rbp), %rax
	movq	%rax, -1048(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, -1088(%rbp)
	movq	-1048(%rbp), %rax
	movq	%rax, -1080(%rbp)
	movq	-1080(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L55
	call	__stack_chk_fail@PLT
.L55:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	rsort_u32, .-rsort_u32
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 400004
b:
	.zero	400004
	.section	.rodata
.LC0:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	call	nextint
	movl	%eax, -16(%rbp)
	call	nextint
	movl	%eax, -12(%rbp)
	movl	$0, -32(%rbp)
	movl	$1, -28(%rbp)
	jmp	.L57
.L58:
	call	nextint
	movl	-32(%rbp), %edx
	addl	%edx, %eax
	cltd
	idivl	-12(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -28(%rbp)
.L57:
	movl	-28(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jle	.L58
	movl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	b(%rip), %rax
	movq	%rax, %rdi
	call	rsort_u32
	movq	$0, -8(%rbp)
	movl	$1, -24(%rbp)
	movl	$1, -20(%rbp)
	jmp	.L59
.L62:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	b(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L60
	movl	-24(%rbp), %eax
	cltq
	addq	%rax, -8(%rbp)
	addl	$1, -24(%rbp)
	jmp	.L61
.L60:
	movl	$1, -24(%rbp)
.L61:
	addl	$1, -20(%rbp)
.L59:
	movl	-20(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jle	.L62
	movq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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:
