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>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll ideg[100010];//入次数

//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g;}E;
typedef struct graph{
	ll vcnt,ecnt;
	E  e[200010];//適宜変える
	ll id[100010];//適宜変える
}G;

int esort(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}

G g;
void readgraph(){
	//適宜変える
	ll n,m;
	scanf("%lld%lld",&n,&m);
	rep(i,0,m){
		ll x,y;
		scanf("%lld%lld",&x,&y);
		x--,y--;
		g.e[i].s=x;
		g.e[i].g=y;
		ideg[y]++;
	}
	g.vcnt=n;
	g.ecnt=m;
	qsort(g.e,g.ecnt,sizeof(E),esort);
//	qsort(g.e,g.ecnt,sizeof(E),csort);

	int p=0;
	rep(i,0,g.vcnt){
		while(p<g.ecnt&&g.e[p].s<i)p++;
		g.id[i]=p;
	}
	g.id[g.vcnt]=g.ecnt;//一応番兵
}

ll st[100010],ptr;//トポソした結果
void toposo(){
	rep(i,0,g.vcnt)if(ideg[i]==0)st[ptr++]=i;
	rep(i,0,g.vcnt){
		ll v=st[i];
		rep(j,g.id[v],g.id[v+1]){
			ideg[g.e[j].g]--;
			if(ideg[g.e[j].g]==0)st[ptr++]=g.e[j].g;
		}
	}
}

int flag[100010];
int dp[100010];
ll calc(int k){
	if(flag[k])return dp[k];
	flag[k]=1;
	ll ans=0;
	rep(i,g.id[k],g.id[k+1]){
		ll temp=calc(g.e[i].g)+1;
		ans=max(ans,temp);
	}
	return dp[k]=ans;
}

int main(){
	readgraph();
	toposo();
	ll ans=0;
	rep(i,0,g.vcnt){
		ll temp=calc(st[i]);
		ans=max(ans,temp);
	}
//	rep(i,0,g.vcnt)printf("%d ",dp[i]);
	printf("%lld\n",ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	upll
	.type	upll, @function
upll:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L2
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	jmp	.L4
.L2:
	movl	$-1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	upll, .-upll
	.globl	downll
	.type	downll, @function
downll:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L6
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L7
	movl	$-1, %eax
	jmp	.L10
.L7:
	movl	$0, %eax
	jmp	.L10
.L6:
	movl	$1, %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	downll, .-downll
	.globl	sortup
	.type	sortup, @function
sortup:
.LFB8:
	.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	upll(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sortup, .-sortup
	.globl	sortdown
	.type	sortdown, @function
sortdown:
.LFB9:
	.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	downll(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	sortdown, .-sortdown
	.globl	pom
	.type	pom, @function
pom:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movq	$1, -8(%rbp)
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movq	-24(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, -24(%rbp)
	jmp	.L14
.L17:
	movq	-32(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L16
	movq	-8(%rbp), %rax
	imulq	-24(%rbp), %rax
	movl	-36(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -8(%rbp)
.L16:
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	movl	-36(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -24(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -32(%rbp)
.L14:
	cmpq	$0, -32(%rbp)
	jne	.L17
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	pom, .-pom
	.globl	ideg
	.bss
	.align 32
	.type	ideg, @object
	.size	ideg, 800080
ideg:
	.zero	800080
	.text
	.globl	esort
	.type	esort, @function
esort:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jge	.L20
	movl	$-1, %eax
	jmp	.L21
.L20:
	movq	-16(%rbp), %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L22
	movl	$1, %eax
	jmp	.L21
.L22:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	cmpq	%rax, %rdx
	jge	.L23
	movl	$-1, %eax
	jmp	.L21
.L23:
	movl	$1, %eax
.L21:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	esort, .-esort
	.globl	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 4000256
g:
	.zero	4000256
	.section	.rodata
.LC0:
	.string	"%lld%lld"
	.text
	.globl	readgraph
	.type	readgraph, @function
readgraph:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -24(%rbp)
	jmp	.L25
.L26:
	leaq	-32(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -40(%rbp)
	movq	-32(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -32(%rbp)
	movq	-40(%rbp), %rax
	movq	-24(%rbp), %rdx
	addq	$1, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	g(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	-32(%rbp), %rax
	movq	-24(%rbp), %rdx
	addq	$1, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	8+g(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	-32(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rcx
	movq	(%rdx,%rcx), %rdx
	leaq	1(%rdx), %rcx
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addq	$1, -24(%rbp)
.L25:
	movq	-48(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L26
	movq	-56(%rbp), %rax
	movq	%rax, g(%rip)
	movq	-48(%rbp), %rax
	movq	%rax, 8+g(%rip)
	movq	8+g(%rip), %rax
	movq	%rax, %rsi
	leaq	esort(%rip), %rax
	movq	%rax, %rcx
	movl	$16, %edx
	leaq	16+g(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -60(%rbp)
	movq	$0, -16(%rbp)
	jmp	.L27
.L30:
	addl	$1, -60(%rbp)
.L28:
	movl	-60(%rbp), %eax
	movslq	%eax, %rdx
	movq	8+g(%rip), %rax
	cmpq	%rax, %rdx
	jge	.L29
	movl	-60(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jg	.L30
.L29:
	movl	-60(%rbp), %eax
	cltq
	movq	-16(%rbp), %rdx
	addq	$400022, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	g(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addq	$1, -16(%rbp)
.L27:
	movq	g(%rip), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L28
	movq	g(%rip), %rdx
	movq	8+g(%rip), %rax
	addq	$400022, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	g(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	readgraph, .-readgraph
	.globl	st
	.bss
	.align 32
	.type	st, @object
	.size	st, 800080
st:
	.zero	800080
	.globl	ptr
	.align 8
	.type	ptr, @object
	.size	ptr, 8
ptr:
	.zero	8
	.text
	.globl	toposo
	.type	toposo, @function
toposo:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	$0, -32(%rbp)
	jmp	.L34
.L36:
	movq	-32(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jne	.L35
	movq	ptr(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, ptr(%rip)
	leaq	0(,%rax,8), %rcx
	leaq	st(%rip), %rdx
	movq	-32(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
.L35:
	addq	$1, -32(%rbp)
.L34:
	movq	g(%rip), %rax
	cmpq	%rax, -32(%rbp)
	jl	.L36
	movq	$0, -24(%rbp)
	jmp	.L37
.L41:
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	st(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	addq	$400022, %rax
	leaq	0(,%rax,8), %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L38
.L40:
	movq	-16(%rbp), %rax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+g(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rcx
	movq	(%rdx,%rcx), %rdx
	leaq	-1(%rdx), %rcx
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	-16(%rbp), %rax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+g(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jne	.L39
	movq	ptr(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, ptr(%rip)
	movq	-16(%rbp), %rdx
	addq	$1, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	8+g(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rax,8), %rcx
	leaq	st(%rip), %rax
	movq	%rdx, (%rcx,%rax)
.L39:
	addq	$1, -16(%rbp)
.L38:
	movq	-8(%rbp), %rax
	addq	$1, %rax
	addq	$400022, %rax
	leaq	0(,%rax,8), %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L40
	addq	$1, -24(%rbp)
.L37:
	movq	g(%rip), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L41
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	toposo, .-toposo
	.globl	flag
	.bss
	.align 32
	.type	flag, @object
	.size	flag, 400040
flag:
	.zero	400040
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 400040
dp:
	.zero	400040
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB14:
	.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
	movl	%edi, -36(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L43
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	jmp	.L44
.L43:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$1, (%rdx,%rax)
	movq	$0, -24(%rbp)
	movl	-36(%rbp), %eax
	cltq
	addq	$400022, %rax
	leaq	0(,%rax,8), %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L45
.L46:
	movq	-16(%rbp), %rax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+g(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	%eax, %edi
	call	calc
	addq	$1, %rax
	movq	%rax, -8(%rbp)
	movq	-24(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	movq	%rax, -24(%rbp)
	addq	$1, -16(%rbp)
.L45:
	movl	-36(%rbp), %eax
	addl	$1, %eax
	cltq
	addq	$400022, %rax
	leaq	0(,%rax,8), %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L46
	movq	-24(%rbp), %rax
	movl	%eax, %ecx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
.L44:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.size	calc, .-calc
	.section	.rodata
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB15:
	.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
	movl	$0, %eax
	call	readgraph
	movl	$0, %eax
	call	toposo
	movq	$0, -24(%rbp)
	movq	$0, -16(%rbp)
	jmp	.L48
.L49:
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	st(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	%eax, %edi
	call	calc
	movq	%rax, -8(%rbp)
	movq	-24(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	movq	%rax, -24(%rbp)
	addq	$1, -16(%rbp)
.L48:
	movq	g(%rip), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L49
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE15:
	.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	upll
	.type	upll, @function
upll:
.LFB51:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	cmpq	%rax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE51:
	.size	upll, .-upll
	.p2align 4
	.globl	downll
	.type	downll, @function
downll:
.LFB52:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rdx
	movl	$1, %eax
	cmpq	%rdx, (%rdi)
	jl	.L5
	setg	%al
	movzbl	%al, %eax
	negl	%eax
.L5:
	ret
	.cfi_endproc
.LFE52:
	.size	downll, .-downll
	.p2align 4
	.globl	esort
	.type	esort, @function
esort:
.LFB56:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rdx
	movl	$-1, %eax
	cmpq	%rdx, (%rdi)
	jl	.L8
	movl	$1, %eax
	jg	.L8
	movq	8(%rsi), %rax
	cmpq	%rax, 8(%rdi)
	setge	%al
	movzbl	%al, %eax
	leal	-1(%rax,%rax), %eax
.L8:
	ret
	.cfi_endproc
.LFE56:
	.size	esort, .-esort
	.p2align 4
	.type	calc.part.0, @function
calc.part.0:
.LFB61:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rax
	leaq	g(%rip), %rdx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	flag(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$152, %rsp
	.cfi_def_cfa_offset 208
	movl	$1, 0(%rbp,%rax,4)
	movq	3200176(%rdx,%rax,8), %rcx
	movq	%rax, 136(%rsp)
	leal	1(%rdi), %eax
	cltq
	movq	%rcx, 96(%rsp)
	movq	3200176(%rdx,%rax,8), %rax
	movq	%rax, 128(%rsp)
	cmpq	%rax, %rcx
	jge	.L35
	leaq	dp(%rip), %rax
	leaq	24(%rdx), %r15
	movq	$0, 120(%rsp)
	movq	%rax, 8(%rsp)
.L34:
	movq	96(%rsp), %rax
	salq	$4, %rax
	movq	(%r15,%rax), %rax
	movslq	%eax, %rdx
	movq	%rdx, 112(%rsp)
	movl	0(%rbp,%rdx,4), %edx
	testl	%edx, %edx
	jne	.L46
	movq	112(%rsp), %rsi
	addl	$1, %eax
	leaq	g(%rip), %rdi
	cltq
	movq	3200176(%rdi,%rsi,8), %rcx
	movl	$1, 0(%rbp,%rsi,4)
	movq	3200176(%rdi,%rax,8), %rsi
	movl	$1, %eax
	movq	%rcx, 64(%rsp)
	movq	%rsi, 104(%rsp)
	cmpq	%rsi, %rcx
	jge	.L17
	movq	$0, 88(%rsp)
.L33:
	movq	64(%rsp), %rax
	salq	$4, %rax
	movq	(%r15,%rax), %rax
	movslq	%eax, %rdx
	movq	%rdx, 80(%rsp)
	movl	0(%rbp,%rdx,4), %edx
	testl	%edx, %edx
	jne	.L47
	movq	80(%rsp), %rsi
	addl	$1, %eax
	leaq	g(%rip), %rcx
	cltq
	movl	$1, 0(%rbp,%rsi,4)
	movq	3200176(%rcx,%rsi,8), %rsi
	movq	3200176(%rcx,%rax,8), %rcx
	movl	$1, %eax
	movq	%rsi, 16(%rsp)
	movq	%rcx, 72(%rsp)
	cmpq	%rcx, %rsi
	jge	.L20
	movq	$0, 40(%rsp)
.L32:
	movq	16(%rsp), %rax
	salq	$4, %rax
	movq	(%r15,%rax), %rax
	movslq	%eax, %rdx
	movq	%rdx, 32(%rsp)
	movl	0(%rbp,%rdx,4), %edx
	testl	%edx, %edx
	jne	.L48
	movq	32(%rsp), %rcx
	addl	$1, %eax
	movl	$1, %esi
	leaq	g(%rip), %rdi
	cltq
	movq	3200176(%rdi,%rax,8), %rax
	movq	3200176(%rdi,%rcx,8), %r14
	movl	$1, 0(%rbp,%rcx,4)
	movq	%rax, 24(%rsp)
	cmpq	%rax, %r14
	jge	.L23
	xorl	%r13d, %r13d
	movq	%r14, %r12
	movq	%r13, %r14
.L31:
	movq	%r12, %rax
	salq	$4, %rax
	movq	(%r15,%rax), %rax
	movslq	%eax, %rsi
	movl	0(%rbp,%rsi,4), %edi
	testl	%edi, %edi
	jne	.L49
	addl	$1, %eax
	leaq	g(%rip), %rcx
	movl	$1, %ebx
	movl	$1, 0(%rbp,%rsi,4)
	cltq
	movq	3200176(%rcx,%rsi,8), %r13
	movq	3200176(%rcx,%rax,8), %r8
	cmpq	%r13, %r8
	jle	.L26
	movq	%rsi, 56(%rsp)
	xorl	%ebx, %ebx
	movq	%r13, %rax
	movq	%r12, 48(%rsp)
	movq	%rbx, %r13
	movq	%r8, %r12
	movq	%rax, %rbx
.L30:
	movq	%rbx, %rax
	salq	$4, %rax
	movq	(%r15,%rax), %rax
	movl	%eax, %edi
	cltq
	movl	0(%rbp,%rax,4), %edx
	testl	%edx, %edx
	jne	.L50
	call	calc.part.0
	addq	$1, %rax
	cmpq	%rax, %r13
	cmovl	%rax, %r13
	addq	$1, %rbx
	cmpq	%rbx, %r12
	jne	.L30
.L45:
	movslq	%r13d, %rbx
	movq	48(%rsp), %r12
	movq	56(%rsp), %rsi
	movl	%r13d, %edi
	addq	$1, %rbx
.L26:
	movq	8(%rsp), %rax
	movl	%edi, (%rax,%rsi,4)
.L25:
	cmpq	%rbx, %r14
	cmovl	%rbx, %r14
	addq	$1, %r12
	cmpq	24(%rsp), %r12
	jne	.L31
	movslq	%r14d, %rsi
	movl	%r14d, %edx
	addq	$1, %rsi
.L23:
	movq	8(%rsp), %rax
	movq	32(%rsp), %rcx
	movl	%edx, (%rax,%rcx,4)
.L22:
	movq	40(%rsp), %rax
	cmpq	%rsi, %rax
	cmovge	%rax, %rsi
	addq	$1, 16(%rsp)
	movq	16(%rsp), %rax
	movq	%rsi, 40(%rsp)
	cmpq	72(%rsp), %rax
	jne	.L32
	movq	%rsi, %rax
	movl	%esi, %edx
	cltq
	addq	$1, %rax
.L20:
	movq	8(%rsp), %rsi
	movq	80(%rsp), %rdi
	movl	%edx, (%rsi,%rdi,4)
.L19:
	movq	88(%rsp), %rcx
	cmpq	%rax, %rcx
	cmovge	%rcx, %rax
	addq	$1, 64(%rsp)
	movq	%rax, 88(%rsp)
	movq	64(%rsp), %rax
	cmpq	104(%rsp), %rax
	jne	.L33
	movq	88(%rsp), %rax
	movl	%eax, %edx
	cltq
	addq	$1, %rax
.L17:
	movq	8(%rsp), %rdi
	movq	112(%rsp), %rcx
	movl	%edx, (%rdi,%rcx,4)
.L16:
	movq	120(%rsp), %rdx
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	addq	$1, 96(%rsp)
	movq	%rax, 120(%rsp)
	movq	96(%rsp), %rax
	cmpq	128(%rsp), %rax
	jne	.L34
	movq	120(%rsp), %rax
	movl	%eax, %edx
	cltq
.L14:
	movq	8(%rsp), %rdi
	movq	136(%rsp), %rsi
	movl	%edx, (%rdi,%rsi,4)
	addq	$152, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
	.p2align 4,,10
	.p2align 3
.L50:
	.cfi_restore_state
	movq	8(%rsp), %rdx
	movslq	(%rdx,%rax,4), %rax
	addq	$1, %rax
	cmpq	%rax, %r13
	cmovl	%rax, %r13
	addq	$1, %rbx
	cmpq	%r12, %rbx
	jne	.L30
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L49:
	movq	8(%rsp), %rax
	movslq	(%rax,%rsi,4), %rbx
	addq	$1, %rbx
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L48:
	movq	8(%rsp), %rax
	movq	32(%rsp), %rdx
	movslq	(%rax,%rdx,4), %rsi
	addq	$1, %rsi
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L47:
	movq	8(%rsp), %rax
	movq	80(%rsp), %rdx
	movslq	(%rax,%rdx,4), %rax
	addq	$1, %rax
	jmp	.L19
.L46:
	movq	8(%rsp), %rax
	movq	112(%rsp), %rdx
	movslq	(%rax,%rdx,4), %rax
	addq	$1, %rax
	jmp	.L16
.L35:
	leaq	dp(%rip), %rdi
	xorl	%eax, %eax
	xorl	%edx, %edx
	movq	%rdi, 8(%rsp)
	jmp	.L14
	.cfi_endproc
.LFE61:
	.size	calc.part.0, .-calc.part.0
	.p2align 4
	.globl	sortup
	.type	sortup, @function
sortup:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	leaq	upll(%rip), %rcx
	movl	$8, %edx
	jmp	qsort@PLT
	.cfi_endproc
.LFE53:
	.size	sortup, .-sortup
	.p2align 4
	.globl	sortdown
	.type	sortdown, @function
sortdown:
.LFB54:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	leaq	downll(%rip), %rcx
	movl	$8, %edx
	jmp	qsort@PLT
	.cfi_endproc
.LFE54:
	.size	sortdown, .-sortdown
	.p2align 4
	.globl	pom
	.type	pom, @function
pom:
.LFB55:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movslq	%edx, %r8
	movl	$1, %r9d
	cqto
	idivq	%r8
	movq	%rdx, %rcx
	testq	%rsi, %rsi
	je	.L53
	.p2align 4,,10
	.p2align 3
.L56:
	testb	$1, %sil
	je	.L55
	movq	%r9, %rax
	imulq	%rcx, %rax
	cqto
	idivq	%r8
	movq	%rdx, %r9
.L55:
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	cqto
	idivq	%r8
	movq	%rsi, %rax
	shrq	$63, %rax
	addq	%rax, %rsi
	sarq	%rsi
	movq	%rdx, %rcx
	jne	.L56
.L53:
	movq	%r9, %rax
	ret
	.cfi_endproc
.LFE55:
	.size	pom, .-pom
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld%lld"
	.section	.text.unlikely,"ax",@progbits
.LCOLDB1:
	.text
.LHOTB1:
	.p2align 4
	.globl	readgraph
	.type	readgraph, @function
readgraph:
.LFB57:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	16+g(%rip), %rbx
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rsi
	leaq	32(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movq	32(%rsp), %rsi
	testq	%rsi, %rsi
	jle	.L63
	leaq	40(%rsp), %rax
	movq	%rbx, %rbp
	leaq	48(%rsp), %r14
	xorl	%r15d, %r15d
	movq	%rax, 8(%rsp)
	leaq	ideg(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L64:
	movq	8(%rsp), %rsi
	movq	%r14, %rdx
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$1, %r15
	addq	$16, %rbp
	call	__isoc99_scanf@PLT
	movq	48(%rsp), %rax
	movq	40(%rsp), %rdi
	movq	32(%rsp), %rsi
	subq	$1, %rax
	leaq	-1(%rdi), %rdx
	movq	%rdx, -16(%rbp)
	movq	%rax, -8(%rbp)
	addq	$1, 0(%r13,%rax,8)
	cmpq	%r15, %rsi
	jg	.L64
.L63:
	movq	24(%rsp), %xmm0
	movq	%rsi, %xmm3
	movq	%rbx, %rdi
	leaq	esort(%rip), %rcx
	movl	$16, %edx
	punpcklqdq	%xmm3, %xmm0
	movaps	%xmm0, g(%rip)
	call	qsort@PLT
	movq	g(%rip), %r9
	movq	8+g(%rip), %rdi
	testq	%r9, %r9
	jle	.L65
	xorl	%esi, %esi
	xorl	%edx, %edx
	leaq	3200176+g(%rip), %r10
	.p2align 4,,10
	.p2align 3
.L66:
	movslq	%edx, %r8
	cmpq	%r8, %rdi
	jle	.L92
	movq	%r8, %rax
	jmp	.L78
	.p2align 4,,10
	.p2align 3
.L68:
	leal	1(%rax), %edx
	addq	$1, %rax
	cmpq	%rax, %rdi
	je	.L93
.L78:
	movq	%rax, %rcx
	movl	%eax, %edx
	salq	$4, %rcx
	cmpq	%rsi, (%rbx,%rcx)
	jl	.L68
	movq	%rax, (%r10,%rsi,8)
	addq	$1, %rsi
	cmpq	%rsi, %r9
	jne	.L66
.L65:
	leaq	g(%rip), %rax
.L71:
	movq	%rdi, 3200176(%rax,%r9,8)
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L94
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
	.p2align 4,,10
	.p2align 3
.L93:
	.cfi_restore_state
	movq	%rdi, (%r10,%rsi,8)
	addq	$1, %rsi
	cmpq	%rsi, %r9
	je	.L65
	cmpq	%r8, %rdi
	jg	.L66
.L80:
	movq	%r9, %rax
	movl	$1, %ecx
	subq	%rsi, %rax
	cmpq	%rsi, %r9
	cmovg	%rax, %rcx
	subq	$1, %rax
	cmpq	$2, %rax
	jbe	.L84
	jmp	.L87
	.p2align 4,,10
	.p2align 3
.L92:
	movq	%r8, (%r10,%rsi,8)
	addq	$1, %rsi
	cmpq	%rsi, %r9
	jne	.L80
	jmp	.L65
.L94:
	call	__stack_chk_fail@PLT
	.cfi_endproc
	.section	.text.unlikely
	.cfi_startproc
	.type	readgraph.cold, @function
readgraph.cold:
.LFSB57:
.L84:
	.cfi_def_cfa_offset 128
	.cfi_offset 3, -56
	.cfi_offset 6, -48
	.cfi_offset 12, -40
	.cfi_offset 13, -32
	.cfi_offset 14, -24
	.cfi_offset 15, -16
	leaq	g(%rip), %rax
.L73:
	movslq	%edx, %rdx
	leaq	1(%rsi), %rcx
	movq	%rdx, 3200176(%rax,%rsi,8)
	cmpq	%rcx, %r9
	jle	.L71
	leaq	2(%rsi), %rcx
	movq	%rdx, 3200184(%rax,%rsi,8)
	cmpq	%rcx, %r9
	jle	.L71
	movq	%rdx, 3200192(%rax,%rsi,8)
	jmp	.L71
.L87:
	movd	%edx, %xmm4
	pxor	%xmm1, %xmm1
	movq	%rcx, %r10
	xorl	%r8d, %r8d
	pshufd	$0, %xmm4, %xmm0
	leaq	g(%rip), %rax
	shrq	$2, %r10
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	leaq	3200176(%rax,%rsi,8), %r11
	salq	$5, %r10
	punpckldq	%xmm1, %xmm2
	punpckhdq	%xmm1, %xmm0
.L74:
	movups	%xmm2, (%r11,%r8)
	movups	%xmm0, 16(%r11,%r8)
	addq	$32, %r8
	cmpq	%r8, %r10
	jne	.L74
	movq	%rcx, %r8
	andq	$-4, %r8
	addq	%r8, %rsi
	cmpq	%r8, %rcx
	jne	.L73
	jmp	.L71
	.cfi_endproc
.LFE57:
	.text
	.size	readgraph, .-readgraph
	.section	.text.unlikely
	.size	readgraph.cold, .-readgraph.cold
.LCOLDE1:
	.text
.LHOTE1:
	.p2align 4
	.globl	toposo
	.type	toposo, @function
toposo:
.LFB58:
	.cfi_startproc
	endbr64
	movq	g(%rip), %rdx
	testq	%rdx, %rdx
	jle	.L114
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	ptr(%rip), %r8
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	ideg(%rip), %rsi
	leaq	st(%rip), %r9
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%r8, %rdi
	.p2align 4,,10
	.p2align 3
.L99:
	cmpq	$0, (%rsi,%rax,8)
	jne	.L98
	movq	%rax, (%r9,%rdi,8)
	movl	$1, %ecx
	addq	$1, %rdi
.L98:
	addq	$1, %rax
	cmpq	%rdx, %rax
	jne	.L99
	testb	%cl, %cl
	je	.L106
	movq	%rdi, ptr(%rip)
.L100:
	leaq	g(%rip), %rbx
	leaq	st(%rip), %r11
	xorl	%r10d, %r10d
	leaq	(%r9,%rdx,8), %rbp
	leaq	24(%rbx), %r12
	.p2align 4,,10
	.p2align 3
.L104:
	movq	(%r11), %rdx
	movq	3200176(%rbx,%rdx,8), %rax
	movq	3200184(%rbx,%rdx,8), %r8
	cmpq	%r8, %rax
	jge	.L101
	salq	$4, %rax
	salq	$4, %r8
	leaq	24(%rbx,%rax), %rdx
	addq	%r12, %r8
	.p2align 4,,10
	.p2align 3
.L103:
	movq	(%rdx), %rcx
	subq	$1, (%rsi,%rcx,8)
	jne	.L102
	movq	%rcx, (%r9,%rdi,8)
	movl	$1, %r10d
	addq	$1, %rdi
.L102:
	addq	$16, %rdx
	cmpq	%rdx, %r8
	jne	.L103
.L101:
	addq	$8, %r11
	cmpq	%rbp, %r11
	jne	.L104
	testb	%r10b, %r10b
	je	.L95
	movq	%rdi, ptr(%rip)
.L95:
	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
.L106:
	.cfi_restore_state
	movq	%r8, %rdi
	jmp	.L100
.L114:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	ret
	.cfi_endproc
.LFE58:
	.size	toposo, .-toposo
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB59:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movslq	%edi, %r11
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	flag(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	(%r12,%r11,4), %edx
	testl	%edx, %edx
	jne	.L128
	addl	$1, %edi
	leaq	g(%rip), %rax
	movl	$1, (%r12,%r11,4)
	movslq	%edi, %rdi
	movq	3200176(%rax,%r11,8), %r9
	movq	3200176(%rax,%rdi,8), %r13
	cmpq	%r13, %r9
	jge	.L125
	xorl	%r10d, %r10d
	leaq	dp(%rip), %rbx
	leaq	24(%rax), %rbp
.L124:
	movq	%r9, %rax
	salq	$4, %rax
	movq	0(%rbp,%rax), %rax
	movl	%eax, %edi
	cltq
	movl	(%r12,%rax,4), %edx
	testl	%edx, %edx
	jne	.L129
	call	calc.part.0
.L127:
	addq	$1, %rax
	cmpq	%rax, %r10
	cmovl	%rax, %r10
	addq	$1, %r9
	cmpq	%r9, %r13
	jne	.L124
	movl	%r10d, %edx
	movslq	%r10d, %rax
.L120:
	movl	%edx, (%rbx,%r11,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L129:
	.cfi_restore_state
	movslq	(%rbx,%rax,4), %rax
	jmp	.L127
	.p2align 4,,10
	.p2align 3
.L128:
	leaq	dp(%rip), %rax
	movslq	(%rax,%r11,4), %rax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L125:
	.cfi_restore_state
	xorl	%eax, %eax
	leaq	dp(%rip), %rbx
	jmp	.L120
	.cfi_endproc
.LFE59:
	.size	calc, .-calc
	.section	.rodata.str1.1
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB60:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	readgraph
	xorl	%eax, %eax
	call	toposo
	movq	g(%rip), %rax
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	jle	.L140
	xorl	%r14d, %r14d
	xorl	%r11d, %r11d
	leaq	flag(%rip), %r13
	leaq	dp(%rip), %rbp
	leaq	24+g(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L139:
	leaq	st(%rip), %rax
	movq	(%rax,%r14,8), %rax
	movslq	%eax, %r15
	movl	0(%r13,%r15,4), %edi
	testl	%edi, %edi
	jne	.L144
	addl	$1, %eax
	leaq	g(%rip), %rcx
	xorl	%r9d, %r9d
	movl	$1, 0(%r13,%r15,4)
	cltq
	movq	3200176(%rcx,%r15,8), %r10
	movq	3200176(%rcx,%rax,8), %r12
	cmpq	%r12, %r10
	jge	.L134
.L138:
	movq	%r10, %rax
	salq	$4, %rax
	movq	(%rbx,%rax), %rax
	movl	%eax, %edi
	cltq
	movl	0(%r13,%rax,4), %edx
	testl	%edx, %edx
	jne	.L145
	call	calc.part.0
	addq	$1, %rax
	cmpq	%rax, %r9
	cmovl	%rax, %r9
	addq	$1, %r10
	cmpq	%r12, %r10
	jne	.L138
.L137:
	movl	%r9d, %edi
	movslq	%r9d, %r9
.L134:
	movl	%edi, 0(%rbp,%r15,4)
.L133:
	cmpq	%r9, %r11
	cmovl	%r9, %r11
	addq	$1, %r14
	cmpq	8(%rsp), %r14
	jne	.L139
.L131:
	movq	%r11, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	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
	.p2align 4,,10
	.p2align 3
.L145:
	.cfi_restore_state
	movslq	0(%rbp,%rax,4), %rax
	addq	$1, %rax
	cmpq	%rax, %r9
	cmovl	%rax, %r9
	addq	$1, %r10
	cmpq	%r10, %r12
	jne	.L138
	jmp	.L137
	.p2align 4,,10
	.p2align 3
.L144:
	movslq	0(%rbp,%r15,4), %r9
	jmp	.L133
.L140:
	xorl	%r11d, %r11d
	jmp	.L131
	.cfi_endproc
.LFE60:
	.size	main, .-main
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 400040
dp:
	.zero	400040
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 400040
flag:
	.zero	400040
	.globl	ptr
	.align 8
	.type	ptr, @object
	.size	ptr, 8
ptr:
	.zero	8
	.globl	st
	.align 32
	.type	st, @object
	.size	st, 800080
st:
	.zero	800080
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 4000256
g:
	.zero	4000256
	.globl	ideg
	.align 32
	.type	ideg, @object
	.size	ideg, 800080
ideg:
	.zero	800080
	.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	upll
	.type	upll, @function
upll:
.LFB51:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	cmpq	%rax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE51:
	.size	upll, .-upll
	.p2align 4
	.globl	downll
	.type	downll, @function
downll:
.LFB52:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rdx
	movl	$1, %eax
	cmpq	%rdx, (%rdi)
	jl	.L5
	setg	%al
	movzbl	%al, %eax
	negl	%eax
.L5:
	ret
	.cfi_endproc
.LFE52:
	.size	downll, .-downll
	.p2align 4
	.globl	esort
	.type	esort, @function
esort:
.LFB56:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rdx
	movl	$-1, %eax
	cmpq	%rdx, (%rdi)
	jl	.L8
	movl	$1, %eax
	jg	.L8
	movq	8(%rsi), %rax
	cmpq	%rax, 8(%rdi)
	setge	%al
	movzbl	%al, %eax
	leal	-1(%rax,%rax), %eax
.L8:
	ret
	.cfi_endproc
.LFE56:
	.size	esort, .-esort
	.p2align 4
	.type	calc.part.0, @function
calc.part.0:
.LFB61:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rax
	leaq	g(%rip), %rdx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	flag(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$152, %rsp
	.cfi_def_cfa_offset 208
	movl	$1, 0(%rbp,%rax,4)
	movq	3200176(%rdx,%rax,8), %rcx
	movq	%rax, 136(%rsp)
	leal	1(%rdi), %eax
	cltq
	movq	%rcx, 96(%rsp)
	movq	3200176(%rdx,%rax,8), %rax
	movq	%rax, 128(%rsp)
	cmpq	%rax, %rcx
	jge	.L35
	leaq	dp(%rip), %rax
	leaq	24(%rdx), %r15
	movq	$0, 120(%rsp)
	movq	%rax, 8(%rsp)
.L34:
	movq	96(%rsp), %rax
	salq	$4, %rax
	movq	(%r15,%rax), %rax
	movslq	%eax, %rdx
	movq	%rdx, 112(%rsp)
	movl	0(%rbp,%rdx,4), %edx
	testl	%edx, %edx
	jne	.L46
	movq	112(%rsp), %rsi
	addl	$1, %eax
	leaq	g(%rip), %rdi
	cltq
	movq	3200176(%rdi,%rsi,8), %rcx
	movl	$1, 0(%rbp,%rsi,4)
	movq	3200176(%rdi,%rax,8), %rsi
	movl	$1, %eax
	movq	%rcx, 64(%rsp)
	movq	%rsi, 104(%rsp)
	cmpq	%rsi, %rcx
	jge	.L17
	movq	$0, 88(%rsp)
.L33:
	movq	64(%rsp), %rax
	salq	$4, %rax
	movq	(%r15,%rax), %rax
	movslq	%eax, %rdx
	movq	%rdx, 80(%rsp)
	movl	0(%rbp,%rdx,4), %edx
	testl	%edx, %edx
	jne	.L47
	movq	80(%rsp), %rsi
	addl	$1, %eax
	leaq	g(%rip), %rcx
	cltq
	movl	$1, 0(%rbp,%rsi,4)
	movq	3200176(%rcx,%rsi,8), %rsi
	movq	3200176(%rcx,%rax,8), %rcx
	movl	$1, %eax
	movq	%rsi, 16(%rsp)
	movq	%rcx, 72(%rsp)
	cmpq	%rcx, %rsi
	jge	.L20
	movq	$0, 40(%rsp)
.L32:
	movq	16(%rsp), %rax
	salq	$4, %rax
	movq	(%r15,%rax), %rax
	movslq	%eax, %rdx
	movq	%rdx, 32(%rsp)
	movl	0(%rbp,%rdx,4), %edx
	testl	%edx, %edx
	jne	.L48
	movq	32(%rsp), %rcx
	addl	$1, %eax
	movl	$1, %esi
	leaq	g(%rip), %rdi
	cltq
	movq	3200176(%rdi,%rax,8), %rax
	movq	3200176(%rdi,%rcx,8), %r14
	movl	$1, 0(%rbp,%rcx,4)
	movq	%rax, 24(%rsp)
	cmpq	%rax, %r14
	jge	.L23
	xorl	%r13d, %r13d
	movq	%r14, %r12
	movq	%r13, %r14
.L31:
	movq	%r12, %rax
	salq	$4, %rax
	movq	(%r15,%rax), %rax
	movslq	%eax, %rsi
	movl	0(%rbp,%rsi,4), %edi
	testl	%edi, %edi
	jne	.L49
	addl	$1, %eax
	leaq	g(%rip), %rcx
	movl	$1, %ebx
	movl	$1, 0(%rbp,%rsi,4)
	cltq
	movq	3200176(%rcx,%rsi,8), %r13
	movq	3200176(%rcx,%rax,8), %r8
	cmpq	%r13, %r8
	jle	.L26
	movq	%rsi, 56(%rsp)
	xorl	%ebx, %ebx
	movq	%r13, %rax
	movq	%r12, 48(%rsp)
	movq	%rbx, %r13
	movq	%r8, %r12
	movq	%rax, %rbx
.L30:
	movq	%rbx, %rax
	salq	$4, %rax
	movq	(%r15,%rax), %rax
	movl	%eax, %edi
	cltq
	movl	0(%rbp,%rax,4), %edx
	testl	%edx, %edx
	jne	.L50
	call	calc.part.0
	addq	$1, %rax
	cmpq	%rax, %r13
	cmovl	%rax, %r13
	addq	$1, %rbx
	cmpq	%rbx, %r12
	jne	.L30
.L45:
	movslq	%r13d, %rbx
	movq	48(%rsp), %r12
	movq	56(%rsp), %rsi
	movl	%r13d, %edi
	addq	$1, %rbx
.L26:
	movq	8(%rsp), %rax
	movl	%edi, (%rax,%rsi,4)
.L25:
	cmpq	%rbx, %r14
	cmovl	%rbx, %r14
	addq	$1, %r12
	cmpq	24(%rsp), %r12
	jne	.L31
	movslq	%r14d, %rsi
	movl	%r14d, %edx
	addq	$1, %rsi
.L23:
	movq	8(%rsp), %rax
	movq	32(%rsp), %rcx
	movl	%edx, (%rax,%rcx,4)
.L22:
	movq	40(%rsp), %rax
	cmpq	%rsi, %rax
	cmovge	%rax, %rsi
	addq	$1, 16(%rsp)
	movq	16(%rsp), %rax
	movq	%rsi, 40(%rsp)
	cmpq	72(%rsp), %rax
	jne	.L32
	movq	%rsi, %rax
	movl	%esi, %edx
	cltq
	addq	$1, %rax
.L20:
	movq	8(%rsp), %rsi
	movq	80(%rsp), %rdi
	movl	%edx, (%rsi,%rdi,4)
.L19:
	movq	88(%rsp), %rcx
	cmpq	%rax, %rcx
	cmovge	%rcx, %rax
	addq	$1, 64(%rsp)
	movq	%rax, 88(%rsp)
	movq	64(%rsp), %rax
	cmpq	104(%rsp), %rax
	jne	.L33
	movq	88(%rsp), %rax
	movl	%eax, %edx
	cltq
	addq	$1, %rax
.L17:
	movq	8(%rsp), %rdi
	movq	112(%rsp), %rcx
	movl	%edx, (%rdi,%rcx,4)
.L16:
	movq	120(%rsp), %rdx
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	addq	$1, 96(%rsp)
	movq	%rax, 120(%rsp)
	movq	96(%rsp), %rax
	cmpq	128(%rsp), %rax
	jne	.L34
	movq	120(%rsp), %rax
	movl	%eax, %edx
	cltq
.L14:
	movq	8(%rsp), %rdi
	movq	136(%rsp), %rsi
	movl	%edx, (%rdi,%rsi,4)
	addq	$152, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
	.p2align 4,,10
	.p2align 3
.L50:
	.cfi_restore_state
	movq	8(%rsp), %rdx
	movslq	(%rdx,%rax,4), %rax
	addq	$1, %rax
	cmpq	%rax, %r13
	cmovl	%rax, %r13
	addq	$1, %rbx
	cmpq	%r12, %rbx
	jne	.L30
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L49:
	movq	8(%rsp), %rax
	movslq	(%rax,%rsi,4), %rbx
	addq	$1, %rbx
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L48:
	movq	8(%rsp), %rax
	movq	32(%rsp), %rdx
	movslq	(%rax,%rdx,4), %rsi
	addq	$1, %rsi
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L47:
	movq	8(%rsp), %rax
	movq	80(%rsp), %rdx
	movslq	(%rax,%rdx,4), %rax
	addq	$1, %rax
	jmp	.L19
.L46:
	movq	8(%rsp), %rax
	movq	112(%rsp), %rdx
	movslq	(%rax,%rdx,4), %rax
	addq	$1, %rax
	jmp	.L16
.L35:
	leaq	dp(%rip), %rdi
	xorl	%eax, %eax
	xorl	%edx, %edx
	movq	%rdi, 8(%rsp)
	jmp	.L14
	.cfi_endproc
.LFE61:
	.size	calc.part.0, .-calc.part.0
	.p2align 4
	.globl	sortup
	.type	sortup, @function
sortup:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	leaq	upll(%rip), %rcx
	movl	$8, %edx
	jmp	qsort@PLT
	.cfi_endproc
.LFE53:
	.size	sortup, .-sortup
	.p2align 4
	.globl	sortdown
	.type	sortdown, @function
sortdown:
.LFB54:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	leaq	downll(%rip), %rcx
	movl	$8, %edx
	jmp	qsort@PLT
	.cfi_endproc
.LFE54:
	.size	sortdown, .-sortdown
	.p2align 4
	.globl	pom
	.type	pom, @function
pom:
.LFB55:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movslq	%edx, %r8
	movl	$1, %r9d
	cqto
	idivq	%r8
	movq	%rdx, %rcx
	testq	%rsi, %rsi
	je	.L53
	.p2align 4,,10
	.p2align 3
.L56:
	testb	$1, %sil
	je	.L55
	movq	%r9, %rax
	imulq	%rcx, %rax
	cqto
	idivq	%r8
	movq	%rdx, %r9
.L55:
	imulq	%rcx, %rcx
	movq	%rcx, %rax
	cqto
	idivq	%r8
	movq	%rsi, %rax
	shrq	$63, %rax
	addq	%rax, %rsi
	sarq	%rsi
	movq	%rdx, %rcx
	jne	.L56
.L53:
	movq	%r9, %rax
	ret
	.cfi_endproc
.LFE55:
	.size	pom, .-pom
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld%lld"
	.section	.text.unlikely,"ax",@progbits
.LCOLDB1:
	.text
.LHOTB1:
	.p2align 4
	.globl	readgraph
	.type	readgraph, @function
readgraph:
.LFB57:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	16+g(%rip), %rbx
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rsi
	leaq	32(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movq	32(%rsp), %rsi
	testq	%rsi, %rsi
	jle	.L63
	leaq	40(%rsp), %rax
	movq	%rbx, %rbp
	leaq	48(%rsp), %r14
	xorl	%r15d, %r15d
	movq	%rax, 8(%rsp)
	leaq	ideg(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L64:
	movq	8(%rsp), %rsi
	movq	%r14, %rdx
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$1, %r15
	addq	$16, %rbp
	call	__isoc99_scanf@PLT
	movq	48(%rsp), %rax
	movq	40(%rsp), %rdi
	movq	32(%rsp), %rsi
	subq	$1, %rax
	leaq	-1(%rdi), %rdx
	movq	%rdx, -16(%rbp)
	movq	%rax, -8(%rbp)
	addq	$1, 0(%r13,%rax,8)
	cmpq	%r15, %rsi
	jg	.L64
.L63:
	movq	24(%rsp), %xmm0
	movq	%rsi, %xmm3
	movq	%rbx, %rdi
	leaq	esort(%rip), %rcx
	movl	$16, %edx
	punpcklqdq	%xmm3, %xmm0
	movaps	%xmm0, g(%rip)
	call	qsort@PLT
	movq	g(%rip), %r9
	movq	8+g(%rip), %rdi
	testq	%r9, %r9
	jle	.L65
	xorl	%esi, %esi
	xorl	%edx, %edx
	leaq	3200176+g(%rip), %r10
	.p2align 4,,10
	.p2align 3
.L66:
	movslq	%edx, %r8
	cmpq	%r8, %rdi
	jle	.L92
	movq	%r8, %rax
	jmp	.L78
	.p2align 4,,10
	.p2align 3
.L68:
	leal	1(%rax), %edx
	addq	$1, %rax
	cmpq	%rax, %rdi
	je	.L93
.L78:
	movq	%rax, %rcx
	movl	%eax, %edx
	salq	$4, %rcx
	cmpq	%rsi, (%rbx,%rcx)
	jl	.L68
	movq	%rax, (%r10,%rsi,8)
	addq	$1, %rsi
	cmpq	%rsi, %r9
	jne	.L66
.L65:
	leaq	g(%rip), %rax
.L71:
	movq	%rdi, 3200176(%rax,%r9,8)
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L94
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
	.p2align 4,,10
	.p2align 3
.L93:
	.cfi_restore_state
	movq	%rdi, (%r10,%rsi,8)
	addq	$1, %rsi
	cmpq	%rsi, %r9
	je	.L65
	cmpq	%r8, %rdi
	jg	.L66
.L80:
	movq	%r9, %rax
	movl	$1, %ecx
	subq	%rsi, %rax
	cmpq	%rsi, %r9
	cmovg	%rax, %rcx
	subq	$1, %rax
	cmpq	$2, %rax
	jbe	.L84
	jmp	.L87
	.p2align 4,,10
	.p2align 3
.L92:
	movq	%r8, (%r10,%rsi,8)
	addq	$1, %rsi
	cmpq	%rsi, %r9
	jne	.L80
	jmp	.L65
.L94:
	call	__stack_chk_fail@PLT
	.cfi_endproc
	.section	.text.unlikely
	.cfi_startproc
	.type	readgraph.cold, @function
readgraph.cold:
.LFSB57:
.L84:
	.cfi_def_cfa_offset 128
	.cfi_offset 3, -56
	.cfi_offset 6, -48
	.cfi_offset 12, -40
	.cfi_offset 13, -32
	.cfi_offset 14, -24
	.cfi_offset 15, -16
	leaq	g(%rip), %rax
.L73:
	movslq	%edx, %rdx
	leaq	1(%rsi), %rcx
	movq	%rdx, 3200176(%rax,%rsi,8)
	cmpq	%rcx, %r9
	jle	.L71
	leaq	2(%rsi), %rcx
	movq	%rdx, 3200184(%rax,%rsi,8)
	cmpq	%rcx, %r9
	jle	.L71
	movq	%rdx, 3200192(%rax,%rsi,8)
	jmp	.L71
.L87:
	movd	%edx, %xmm4
	pxor	%xmm1, %xmm1
	movq	%rcx, %r10
	xorl	%r8d, %r8d
	pshufd	$0, %xmm4, %xmm0
	leaq	g(%rip), %rax
	shrq	$2, %r10
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	leaq	3200176(%rax,%rsi,8), %r11
	salq	$5, %r10
	punpckldq	%xmm1, %xmm2
	punpckhdq	%xmm1, %xmm0
.L74:
	movups	%xmm2, (%r11,%r8)
	movups	%xmm0, 16(%r11,%r8)
	addq	$32, %r8
	cmpq	%r8, %r10
	jne	.L74
	movq	%rcx, %r8
	andq	$-4, %r8
	addq	%r8, %rsi
	cmpq	%r8, %rcx
	jne	.L73
	jmp	.L71
	.cfi_endproc
.LFE57:
	.text
	.size	readgraph, .-readgraph
	.section	.text.unlikely
	.size	readgraph.cold, .-readgraph.cold
.LCOLDE1:
	.text
.LHOTE1:
	.p2align 4
	.globl	toposo
	.type	toposo, @function
toposo:
.LFB58:
	.cfi_startproc
	endbr64
	movq	g(%rip), %rdx
	testq	%rdx, %rdx
	jle	.L114
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	ptr(%rip), %r8
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	ideg(%rip), %rsi
	leaq	st(%rip), %r9
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%r8, %rdi
	.p2align 4,,10
	.p2align 3
.L99:
	cmpq	$0, (%rsi,%rax,8)
	jne	.L98
	movq	%rax, (%r9,%rdi,8)
	movl	$1, %ecx
	addq	$1, %rdi
.L98:
	addq	$1, %rax
	cmpq	%rdx, %rax
	jne	.L99
	testb	%cl, %cl
	je	.L106
	movq	%rdi, ptr(%rip)
.L100:
	leaq	g(%rip), %rbx
	leaq	st(%rip), %r11
	xorl	%r10d, %r10d
	leaq	(%r9,%rdx,8), %rbp
	leaq	24(%rbx), %r12
	.p2align 4,,10
	.p2align 3
.L104:
	movq	(%r11), %rdx
	movq	3200176(%rbx,%rdx,8), %rax
	movq	3200184(%rbx,%rdx,8), %r8
	cmpq	%r8, %rax
	jge	.L101
	salq	$4, %rax
	salq	$4, %r8
	leaq	24(%rbx,%rax), %rdx
	addq	%r12, %r8
	.p2align 4,,10
	.p2align 3
.L103:
	movq	(%rdx), %rcx
	subq	$1, (%rsi,%rcx,8)
	jne	.L102
	movq	%rcx, (%r9,%rdi,8)
	movl	$1, %r10d
	addq	$1, %rdi
.L102:
	addq	$16, %rdx
	cmpq	%rdx, %r8
	jne	.L103
.L101:
	addq	$8, %r11
	cmpq	%rbp, %r11
	jne	.L104
	testb	%r10b, %r10b
	je	.L95
	movq	%rdi, ptr(%rip)
.L95:
	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
.L106:
	.cfi_restore_state
	movq	%r8, %rdi
	jmp	.L100
.L114:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	ret
	.cfi_endproc
.LFE58:
	.size	toposo, .-toposo
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB59:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movslq	%edi, %r11
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	flag(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	(%r12,%r11,4), %edx
	testl	%edx, %edx
	jne	.L128
	addl	$1, %edi
	leaq	g(%rip), %rax
	movl	$1, (%r12,%r11,4)
	movslq	%edi, %rdi
	movq	3200176(%rax,%r11,8), %r9
	movq	3200176(%rax,%rdi,8), %r13
	cmpq	%r13, %r9
	jge	.L125
	xorl	%r10d, %r10d
	leaq	dp(%rip), %rbx
	leaq	24(%rax), %rbp
.L124:
	movq	%r9, %rax
	salq	$4, %rax
	movq	0(%rbp,%rax), %rax
	movl	%eax, %edi
	cltq
	movl	(%r12,%rax,4), %edx
	testl	%edx, %edx
	jne	.L129
	call	calc.part.0
.L127:
	addq	$1, %rax
	cmpq	%rax, %r10
	cmovl	%rax, %r10
	addq	$1, %r9
	cmpq	%r9, %r13
	jne	.L124
	movl	%r10d, %edx
	movslq	%r10d, %rax
.L120:
	movl	%edx, (%rbx,%r11,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L129:
	.cfi_restore_state
	movslq	(%rbx,%rax,4), %rax
	jmp	.L127
	.p2align 4,,10
	.p2align 3
.L128:
	leaq	dp(%rip), %rax
	movslq	(%rax,%r11,4), %rax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L125:
	.cfi_restore_state
	xorl	%eax, %eax
	leaq	dp(%rip), %rbx
	jmp	.L120
	.cfi_endproc
.LFE59:
	.size	calc, .-calc
	.section	.rodata.str1.1
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB60:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	readgraph
	xorl	%eax, %eax
	call	toposo
	movq	g(%rip), %rax
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	jle	.L140
	xorl	%r14d, %r14d
	xorl	%r11d, %r11d
	leaq	flag(%rip), %r13
	leaq	dp(%rip), %rbp
	leaq	24+g(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L139:
	leaq	st(%rip), %rax
	movq	(%rax,%r14,8), %rax
	movslq	%eax, %r15
	movl	0(%r13,%r15,4), %edi
	testl	%edi, %edi
	jne	.L144
	addl	$1, %eax
	leaq	g(%rip), %rcx
	xorl	%r9d, %r9d
	movl	$1, 0(%r13,%r15,4)
	cltq
	movq	3200176(%rcx,%r15,8), %r10
	movq	3200176(%rcx,%rax,8), %r12
	cmpq	%r12, %r10
	jge	.L134
.L138:
	movq	%r10, %rax
	salq	$4, %rax
	movq	(%rbx,%rax), %rax
	movl	%eax, %edi
	cltq
	movl	0(%r13,%rax,4), %edx
	testl	%edx, %edx
	jne	.L145
	call	calc.part.0
	addq	$1, %rax
	cmpq	%rax, %r9
	cmovl	%rax, %r9
	addq	$1, %r10
	cmpq	%r12, %r10
	jne	.L138
.L137:
	movl	%r9d, %edi
	movslq	%r9d, %r9
.L134:
	movl	%edi, 0(%rbp,%r15,4)
.L133:
	cmpq	%r9, %r11
	cmovl	%r9, %r11
	addq	$1, %r14
	cmpq	8(%rsp), %r14
	jne	.L139
.L131:
	movq	%r11, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	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
	.p2align 4,,10
	.p2align 3
.L145:
	.cfi_restore_state
	movslq	0(%rbp,%rax,4), %rax
	addq	$1, %rax
	cmpq	%rax, %r9
	cmovl	%rax, %r9
	addq	$1, %r10
	cmpq	%r10, %r12
	jne	.L138
	jmp	.L137
	.p2align 4,,10
	.p2align 3
.L144:
	movslq	0(%rbp,%r15,4), %r9
	jmp	.L133
.L140:
	xorl	%r11d, %r11d
	jmp	.L131
	.cfi_endproc
.LFE60:
	.size	main, .-main
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 400040
dp:
	.zero	400040
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 400040
flag:
	.zero	400040
	.globl	ptr
	.align 8
	.type	ptr, @object
	.size	ptr, 8
ptr:
	.zero	8
	.globl	st
	.align 32
	.type	st, @object
	.size	st, 800080
st:
	.zero	800080
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 4000256
g:
	.zero	4000256
	.globl	ideg
	.align 32
	.type	ideg, @object
	.size	ideg, 800080
ideg:
	.zero	800080
	.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>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll ideg[100010];//入次数

//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g;}E;
typedef struct graph{
	ll vcnt,ecnt;
	E  e[200010];//適宜変える
	ll id[100010];//適宜変える
}G;

int esort(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}

G g;
void readgraph(){
	//適宜変える
	ll n,m;
	scanf("%lld%lld",&n,&m);
	rep(i,0,m){
		ll x,y;
		scanf("%lld%lld",&x,&y);
		x--,y--;
		g.e[i].s=x;
		g.e[i].g=y;
		ideg[y]++;
	}
	g.vcnt=n;
	g.ecnt=m;
	qsort(g.e,g.ecnt,sizeof(E),esort);
//	qsort(g.e,g.ecnt,sizeof(E),csort);

	int p=0;
	rep(i,0,g.vcnt){
		while(p<g.ecnt&&g.e[p].s<i)p++;
		g.id[i]=p;
	}
	g.id[g.vcnt]=g.ecnt;//一応番兵
}

ll st[100010],ptr;//トポソした結果
void toposo(){
	rep(i,0,g.vcnt)if(ideg[i]==0)st[ptr++]=i;
	rep(i,0,g.vcnt){
		ll v=st[i];
		rep(j,g.id[v],g.id[v+1]){
			ideg[g.e[j].g]--;
			if(ideg[g.e[j].g]==0)st[ptr++]=g.e[j].g;
		}
	}
}

int flag[100010];
int dp[100010];
ll calc(int k){
	if(flag[k])return dp[k];
	flag[k]=1;
	ll ans=0;
	rep(i,g.id[k],g.id[k+1]){
		ll temp=calc(g.e[i].g)+1;
		ans=max(ans,temp);
	}
	return dp[k]=ans;
}

int main(){
	readgraph();
	toposo();
	ll ans=0;
	rep(i,0,g.vcnt){
		ll temp=calc(st[i]);
		ans=max(ans,temp);
	}
//	rep(i,0,g.vcnt)printf("%d ",dp[i]);
	printf("%lld\n",ans);
	return 0;
}
6 3
2 6
4 5
5 6
 6 3
2 6
4 6
5 6
 6 3
4 3
3 5
5 6
 4 0
1 2
1 3
3 2
2 4
3 4
 7 3
2 3
4 5
5 6
 7 3
2 3
1 5
5 6
 11 3
2 3
4 5
5 6
 4 5
1 2
1 4
3 2
2 4
3 4
 6 3
2 6
4 5
4 6
 7 1
2 3
4 5
5 6

2
 1
 3
 0
 2
 2
 2
 2
 1
 1

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>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll ideg[100010];//入次数

//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g;}E;
typedef struct graph{
	ll vcnt,ecnt;
	E  e[200010];//適宜変える
	ll id[100010];//適宜変える
}G;

int esort(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}

G g;
void readgraph(){
	//適宜変える
	ll n,m;
	scanf("%lld%lld",&n,&m);
	rep(i,0,m){
		ll x,y;
		scanf("%lld%lld",&x,&y);
		x--,y--;
		g.e[i].s=x;
		g.e[i].g=y;
		ideg[y]++;
	}
	g.vcnt=n;
	g.ecnt=m;
	qsort(g.e,g.ecnt,sizeof(E),esort);
//	qsort(g.e,g.ecnt,sizeof(E),csort);

	int p=0;
	rep(i,0,g.vcnt){
		while(p<g.ecnt&&g.e[p].s<i)p++;
		g.id[i]=p;
	}
	g.id[g.vcnt]=g.ecnt;//一応番兵
}

ll st[100010],ptr;//トポソした結果
void toposo(){
	rep(i,0,g.vcnt)if(ideg[i]==0)st[ptr++]=i;
	rep(i,0,g.vcnt){
		ll v=st[i];
		rep(j,g.id[v],g.id[v+1]){
			ideg[g.e[j].g]--;
			if(ideg[g.e[j].g]==0)st[ptr++]=g.e[j].g;
		}
	}
}

int flag[100010];
int dp[100010];
ll calc(int k){
	if(flag[k])return dp[k];
	flag[k]=1;
	ll ans=0;
	rep(i,g.id[k],g.id[k+1]){
		ll temp=calc(g.e[i].g)+1;
		ans=max(ans,temp);
	}
	return dp[k]=ans;
}

int main(){
	readgraph();
	toposo();
	ll ans=0;
	rep(i,0,g.vcnt){
		ll temp=calc(st[i]);
		ans=max(ans,temp);
	}
//	rep(i,0,g.vcnt)printf("%d ",dp[i]);
	printf("%lld\n",ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	upll
	.type	upll, @function
upll:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L2
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	jmp	.L4
.L2:
	movl	$-1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	upll, .-upll
	.globl	downll
	.type	downll, @function
downll:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L6
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L7
	movl	$-1, %eax
	jmp	.L10
.L7:
	movl	$0, %eax
	jmp	.L10
.L6:
	movl	$1, %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	downll, .-downll
	.globl	sortup
	.type	sortup, @function
sortup:
.LFB8:
	.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	upll(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sortup, .-sortup
	.globl	sortdown
	.type	sortdown, @function
sortdown:
.LFB9:
	.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	downll(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	sortdown, .-sortdown
	.globl	pom
	.type	pom, @function
pom:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movq	$1, -8(%rbp)
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movq	-24(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, -24(%rbp)
	jmp	.L14
.L17:
	movq	-32(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L16
	movq	-8(%rbp), %rax
	imulq	-24(%rbp), %rax
	movl	-36(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -8(%rbp)
.L16:
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	movl	-36(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -24(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -32(%rbp)
.L14:
	cmpq	$0, -32(%rbp)
	jne	.L17
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	pom, .-pom
	.globl	ideg
	.bss
	.align 32
	.type	ideg, @object
	.size	ideg, 800080
ideg:
	.zero	800080
	.text
	.globl	esort
	.type	esort, @function
esort:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jge	.L20
	movl	$-1, %eax
	jmp	.L21
.L20:
	movq	-16(%rbp), %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L22
	movl	$1, %eax
	jmp	.L21
.L22:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	cmpq	%rax, %rdx
	jge	.L23
	movl	$-1, %eax
	jmp	.L21
.L23:
	movl	$1, %eax
.L21:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	esort, .-esort
	.globl	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 4000256
g:
	.zero	4000256
	.section	.rodata
.LC0:
	.string	"%lld%lld"
	.text
	.globl	readgraph
	.type	readgraph, @function
readgraph:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -24(%rbp)
	jmp	.L25
.L26:
	leaq	-32(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -40(%rbp)
	movq	-32(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -32(%rbp)
	movq	-40(%rbp), %rax
	movq	-24(%rbp), %rdx
	addq	$1, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	g(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	-32(%rbp), %rax
	movq	-24(%rbp), %rdx
	addq	$1, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	8+g(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	-32(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rcx
	movq	(%rdx,%rcx), %rdx
	leaq	1(%rdx), %rcx
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addq	$1, -24(%rbp)
.L25:
	movq	-48(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L26
	movq	-56(%rbp), %rax
	movq	%rax, g(%rip)
	movq	-48(%rbp), %rax
	movq	%rax, 8+g(%rip)
	movq	8+g(%rip), %rax
	movq	%rax, %rsi
	leaq	esort(%rip), %rax
	movq	%rax, %rcx
	movl	$16, %edx
	leaq	16+g(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -60(%rbp)
	movq	$0, -16(%rbp)
	jmp	.L27
.L30:
	addl	$1, -60(%rbp)
.L28:
	movl	-60(%rbp), %eax
	movslq	%eax, %rdx
	movq	8+g(%rip), %rax
	cmpq	%rax, %rdx
	jge	.L29
	movl	-60(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jg	.L30
.L29:
	movl	-60(%rbp), %eax
	cltq
	movq	-16(%rbp), %rdx
	addq	$400022, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	g(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addq	$1, -16(%rbp)
.L27:
	movq	g(%rip), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L28
	movq	g(%rip), %rdx
	movq	8+g(%rip), %rax
	addq	$400022, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	g(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	readgraph, .-readgraph
	.globl	st
	.bss
	.align 32
	.type	st, @object
	.size	st, 800080
st:
	.zero	800080
	.globl	ptr
	.align 8
	.type	ptr, @object
	.size	ptr, 8
ptr:
	.zero	8
	.text
	.globl	toposo
	.type	toposo, @function
toposo:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	$0, -32(%rbp)
	jmp	.L34
.L36:
	movq	-32(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jne	.L35
	movq	ptr(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, ptr(%rip)
	leaq	0(,%rax,8), %rcx
	leaq	st(%rip), %rdx
	movq	-32(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
.L35:
	addq	$1, -32(%rbp)
.L34:
	movq	g(%rip), %rax
	cmpq	%rax, -32(%rbp)
	jl	.L36
	movq	$0, -24(%rbp)
	jmp	.L37
.L41:
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	st(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	addq	$400022, %rax
	leaq	0(,%rax,8), %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L38
.L40:
	movq	-16(%rbp), %rax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+g(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rcx
	movq	(%rdx,%rcx), %rdx
	leaq	-1(%rdx), %rcx
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	-16(%rbp), %rax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+g(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jne	.L39
	movq	ptr(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, ptr(%rip)
	movq	-16(%rbp), %rdx
	addq	$1, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	8+g(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rax,8), %rcx
	leaq	st(%rip), %rax
	movq	%rdx, (%rcx,%rax)
.L39:
	addq	$1, -16(%rbp)
.L38:
	movq	-8(%rbp), %rax
	addq	$1, %rax
	addq	$400022, %rax
	leaq	0(,%rax,8), %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L40
	addq	$1, -24(%rbp)
.L37:
	movq	g(%rip), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L41
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	toposo, .-toposo
	.globl	flag
	.bss
	.align 32
	.type	flag, @object
	.size	flag, 400040
flag:
	.zero	400040
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 400040
dp:
	.zero	400040
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB14:
	.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
	movl	%edi, -36(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L43
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	jmp	.L44
.L43:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$1, (%rdx,%rax)
	movq	$0, -24(%rbp)
	movl	-36(%rbp), %eax
	cltq
	addq	$400022, %rax
	leaq	0(,%rax,8), %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L45
.L46:
	movq	-16(%rbp), %rax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+g(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	%eax, %edi
	call	calc
	addq	$1, %rax
	movq	%rax, -8(%rbp)
	movq	-24(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	movq	%rax, -24(%rbp)
	addq	$1, -16(%rbp)
.L45:
	movl	-36(%rbp), %eax
	addl	$1, %eax
	cltq
	addq	$400022, %rax
	leaq	0(,%rax,8), %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L46
	movq	-24(%rbp), %rax
	movl	%eax, %ecx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
.L44:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.size	calc, .-calc
	.section	.rodata
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB15:
	.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
	movl	$0, %eax
	call	readgraph
	movl	$0, %eax
	call	toposo
	movq	$0, -24(%rbp)
	movq	$0, -16(%rbp)
	jmp	.L48
.L49:
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	st(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	%eax, %edi
	call	calc
	movq	%rax, -8(%rbp)
	movq	-24(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	movq	%rax, -24(%rbp)
	addq	$1, -16(%rbp)
.L48:
	movq	g(%rip), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L49
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE15:
	.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	upll
	.type	upll, @function
upll:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L2
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	setg	%al
	movzbl	%al, %eax
	jmp	.L4
.L2:
	movl	$-1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	upll, .-upll
	.globl	downll
	.type	downll, @function
downll:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L6
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L7
	movl	$-1, %eax
	jmp	.L10
.L7:
	movl	$0, %eax
	jmp	.L10
.L6:
	movl	$1, %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	downll, .-downll
	.globl	sortup
	.type	sortup, @function
sortup:
.LFB8:
	.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	upll(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sortup, .-sortup
	.globl	sortdown
	.type	sortdown, @function
sortdown:
.LFB9:
	.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-8(%rbp), %rax
	leaq	downll(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	sortdown, .-sortdown
	.globl	pom
	.type	pom, @function
pom:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movq	$1, -8(%rbp)
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movq	-24(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, -24(%rbp)
	jmp	.L14
.L17:
	movq	-32(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L16
	movq	-8(%rbp), %rax
	imulq	-24(%rbp), %rax
	movl	-36(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -8(%rbp)
.L16:
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	movl	-36(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -24(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -32(%rbp)
.L14:
	cmpq	$0, -32(%rbp)
	jne	.L17
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	pom, .-pom
	.globl	ideg
	.bss
	.align 32
	.type	ideg, @object
	.size	ideg, 800080
ideg:
	.zero	800080
	.text
	.globl	esort
	.type	esort, @function
esort:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jge	.L20
	movl	$-1, %eax
	jmp	.L21
.L20:
	movq	-16(%rbp), %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jle	.L22
	movl	$1, %eax
	jmp	.L21
.L22:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	cmpq	%rax, %rdx
	jge	.L23
	movl	$-1, %eax
	jmp	.L21
.L23:
	movl	$1, %eax
.L21:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	esort, .-esort
	.globl	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 4000256
g:
	.zero	4000256
	.section	.rodata
.LC0:
	.string	"%lld%lld"
	.text
	.globl	readgraph
	.type	readgraph, @function
readgraph:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -24(%rbp)
	jmp	.L25
.L26:
	leaq	-32(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -40(%rbp)
	movq	-32(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -32(%rbp)
	movq	-40(%rbp), %rax
	movq	-24(%rbp), %rdx
	addq	$1, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	g(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	-32(%rbp), %rax
	movq	-24(%rbp), %rdx
	addq	$1, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	8+g(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	-32(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rcx
	movq	(%rdx,%rcx), %rdx
	leaq	1(%rdx), %rcx
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addq	$1, -24(%rbp)
.L25:
	movq	-48(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L26
	movq	-56(%rbp), %rax
	movq	%rax, g(%rip)
	movq	-48(%rbp), %rax
	movq	%rax, 8+g(%rip)
	movq	8+g(%rip), %rax
	movq	%rax, %rsi
	leaq	esort(%rip), %rax
	movq	%rax, %rcx
	movl	$16, %edx
	leaq	16+g(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -60(%rbp)
	movq	$0, -16(%rbp)
	jmp	.L27
.L30:
	addl	$1, -60(%rbp)
.L28:
	movl	-60(%rbp), %eax
	movslq	%eax, %rdx
	movq	8+g(%rip), %rax
	cmpq	%rax, %rdx
	jge	.L29
	movl	-60(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jg	.L30
.L29:
	movl	-60(%rbp), %eax
	cltq
	movq	-16(%rbp), %rdx
	addq	$400022, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	g(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addq	$1, -16(%rbp)
.L27:
	movq	g(%rip), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L28
	movq	g(%rip), %rdx
	movq	8+g(%rip), %rax
	addq	$400022, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	g(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	readgraph, .-readgraph
	.globl	st
	.bss
	.align 32
	.type	st, @object
	.size	st, 800080
st:
	.zero	800080
	.globl	ptr
	.align 8
	.type	ptr, @object
	.size	ptr, 8
ptr:
	.zero	8
	.text
	.globl	toposo
	.type	toposo, @function
toposo:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	$0, -32(%rbp)
	jmp	.L34
.L36:
	movq	-32(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jne	.L35
	movq	ptr(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, ptr(%rip)
	leaq	0(,%rax,8), %rcx
	leaq	st(%rip), %rdx
	movq	-32(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
.L35:
	addq	$1, -32(%rbp)
.L34:
	movq	g(%rip), %rax
	cmpq	%rax, -32(%rbp)
	jl	.L36
	movq	$0, -24(%rbp)
	jmp	.L37
.L41:
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	st(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	addq	$400022, %rax
	leaq	0(,%rax,8), %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L38
.L40:
	movq	-16(%rbp), %rax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+g(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rcx
	movq	(%rdx,%rcx), %rdx
	leaq	-1(%rdx), %rcx
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	-16(%rbp), %rax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+g(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ideg(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jne	.L39
	movq	ptr(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, ptr(%rip)
	movq	-16(%rbp), %rdx
	addq	$1, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	8+g(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rax,8), %rcx
	leaq	st(%rip), %rax
	movq	%rdx, (%rcx,%rax)
.L39:
	addq	$1, -16(%rbp)
.L38:
	movq	-8(%rbp), %rax
	addq	$1, %rax
	addq	$400022, %rax
	leaq	0(,%rax,8), %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L40
	addq	$1, -24(%rbp)
.L37:
	movq	g(%rip), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L41
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	toposo, .-toposo
	.globl	flag
	.bss
	.align 32
	.type	flag, @object
	.size	flag, 400040
flag:
	.zero	400040
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 400040
dp:
	.zero	400040
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB14:
	.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
	movl	%edi, -36(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L43
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	jmp	.L44
.L43:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$1, (%rdx,%rax)
	movq	$0, -24(%rbp)
	movl	-36(%rbp), %eax
	cltq
	addq	$400022, %rax
	leaq	0(,%rax,8), %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L45
.L46:
	movq	-16(%rbp), %rax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+g(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	%eax, %edi
	call	calc
	addq	$1, %rax
	movq	%rax, -8(%rbp)
	movq	-24(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	movq	%rax, -24(%rbp)
	addq	$1, -16(%rbp)
.L45:
	movl	-36(%rbp), %eax
	addl	$1, %eax
	cltq
	addq	$400022, %rax
	leaq	0(,%rax,8), %rdx
	leaq	g(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L46
	movq	-24(%rbp), %rax
	movl	%eax, %ecx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
.L44:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.size	calc, .-calc
	.section	.rodata
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB15:
	.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
	movl	$0, %eax
	call	readgraph
	movl	$0, %eax
	call	toposo
	movq	$0, -24(%rbp)
	movq	$0, -16(%rbp)
	jmp	.L48
.L49:
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	st(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	%eax, %edi
	call	calc
	movq	%rax, -8(%rbp)
	movq	-24(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	movq	%rax, -24(%rbp)
	addq	$1, -16(%rbp)
.L48:
	movq	g(%rip), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L49
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE15:
	.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:
