// File: dcarrey[P]hgt-detection/./utils_tree.cpp
// Function: Tree_edges(double**, long*, double*, int, int)
int Tree_edges (double **DI, long int *ARETE, double *LONGUEUR, int n,int binaire)
{

	struct EDGE { unsigned int U; unsigned int V; double LN;};
	struct EDGE *Path,*Tree;
	int i,j,k,p,P,*X;
	double S,DIS,DIS1,*L,**D;
	int pasfini = 1;
	int kt=0;
	int SomToDel,OtherSom;

	X=(int *)malloc((n+1)*sizeof(int));  
	L=(double *)malloc((n+1)*sizeof(double));
	Tree=(struct EDGE *)malloc((2*n-2)*sizeof(struct EDGE));
	Path=(struct EDGE *)malloc((n+2)*sizeof(struct EDGE));


	D=(double **) malloc((n+1)*sizeof(double*));

	for (i=0;i<=n;i++)
	{
		D[i]=(double*)malloc((n+1)*sizeof(double)); 

		if (D[i]==NULL)
		{
			printf("Data matrix is too large"); exit(1); 
		}
	}

	i=1; j=n;
	odp1(DI,X,&i,&j,n);

	for (i=1;i<=n;i++)
	{ 
		for (j=1;j<=n;j++) 
			D[i][j]=DI[i][j];
	}  

	/* Verification de l'equivalence des topologies */
	L[1]=D[X[1]][X[2]];
	Path[1].U=X[1];
	Path[1].V=X[2];

	p=0;
	P=1;

	for(k=2;k<=n-1;k++)
	{

		DIS=(D[X[1]][X[k]]+D[X[1]][X[k+1]]-D[X[k]][X[k+1]])/2;
		DIS1=(D[X[1]][X[k+1]]+D[X[k]][X[k+1]]-D[X[1]][X[k]])/2;

		S=0.0;
		i=0;

		if (DIS>2*epsilon)
		{
			while (S<DIS-(epsilon))
			{
				i=i+1;
				S=S+L[i];
			}
		}
		else { DIS=0; i=1; }

		Tree[p+1].U=n+k-1;
		Tree[p+1].V=Path[i].V;
		Tree[p+1].LN=S-DIS;
		if (Tree[p+1].LN<epsilon) Tree[p+1].LN=2*epsilon; 

		for (j=i+1;j<=P;j++)
		{
			Tree[p+j-i+1].U=Path[j].U;
			Tree[p+j-i+1].V=Path[j].V;
			Tree[p+j-i+1].LN=L[j];
			if (L[j]<2*epsilon) L[j]=2*epsilon; 
		}
		p=p+P-i+1;

		Path[i].V=n+k-1;
		Path[i+1].U=n+k-1;
		Path[i+1].V=X[k+1];
		L[i]=L[i]+DIS-S;
		L[i+1]=DIS1;
		P=i+1;
	}

	for (i=1;i<=P;i++) 
	{
		Tree[p+i].U=Path[i].U;
		Tree[p+i].V=Path[i].V;
		Tree[p+i].LN=L[i];
	}

	for (i=1;i<=2*n-3;i++)
	{
		if (fabs(Tree[i].LN-epsilon)<=2*epsilon)
			Tree[i].LN=0.0;
		ARETE[2*i-2]=Tree[i].U;
		ARETE[2*i-1]=Tree[i].V;
		LONGUEUR[i-1]=Tree[i].LN;   
		if (LONGUEUR[i-1]<2*epsilon) LONGUEUR[i-1] = 2*epsilon;
	} 
	/*/== rajoute le 22 avril 2005*/
	while((pasfini==1)&&(binaire==0)){
		//printf("non-binaire");
		//printf("\n");
		//for(i=1;i<=2*n-3-kt;i++){
		//	printf("\n%d : %d--%d -> %lf",i,ARETE[2*i-2],ARETE[2*i-1],LONGUEUR[i-1]);
		//}
		pasfini = 0;
		for (i=1;i<=2*n-3-kt;i++){
			if((LONGUEUR[i-1] == 2*epsilon)&&(ARETE[2*i-2]>n)&&(ARETE[2*i-1]>n)){	//= branche interne de taille=2*epsilon
				if(ARETE[2*i-2] > ARETE[2*i-1]){
					SomToDel = ARETE[2*i-2];
					OtherSom = ARETE[2*i-1];
				}
				else{
					SomToDel = ARETE[2*i-1];
					OtherSom = ARETE[2*i-2];
				}
				pasfini=1;

				/*/printf("\n\n edge to delete = %d \n\n",SomToDel);
				//== trouver les branches connexes*/
				for (j=1;j<=2*n-3-kt;j++){

					if(j!=i){
						if(ARETE[2*j-2] == SomToDel){/*&&(ARETE[2*j-1] != ARETE[2*i-1])){*/
							ARETE[2*j-2] = OtherSom;
							/*/break;*/
						}
						else if(ARETE[2*j-1] == SomToDel){/*/&&(ARETE[2*j-2] != ARETE[2*i-1])){*/
							ARETE[2*j-1] = OtherSom;
							/*/break;*/
						}
					}
				}
				for(j=i;j<=2*n-3-kt;j++){
					LONGUEUR[j-1] = LONGUEUR[j];
					ARETE[2*j-1] = ARETE[2*(j+1)-1];
					ARETE[2*j-2] = ARETE[2*(j+1)-2];
				}
				for(j=1;j<=2*n-3-kt-1;j++){
					if(ARETE[2*j-2] > SomToDel)
						ARETE[2*j-2]--;
					if(ARETE[2*j-1] > SomToDel)
						ARETE[2*j-1]--;
				}
				break;
			}
		} 
		if(pasfini)
			kt++;
	}

	/*printf("\n\n");
	for(i=1;i<=2*n-3-kt;i++){
	printf("\n%d : %d--%d -> %lf",i,ARETE[2*i-2],ARETE[2*i-1],LONGUEUR[i-1]);
	}
	*/


	/*printf("\n\n");*/

	free(X);
	free(Tree);
	free(L);
	free(Path);


	for (i=0;i<=n;i++)    
		free(D[i]);

	free(D);

	return kt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl $0x1, -0x7c(%rbp)
movl $0x0, -0x80(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x2, %rdi
callq 0x1110
movq %rax, -0x50(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x1110
movq %rax, -0x70(%rbp)
movl -0x1c(%rbp), %eax
shll %eax
subl $0x2, %eax
movslq %eax, %rdi
shlq $0x4, %rdi
callq 0x1110
movq %rax, -0x30(%rbp)
movl -0x1c(%rbp), %eax
addl $0x2, %eax
movslq %eax, %rdi
shlq $0x4, %rdi
callq 0x1110
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x1110
movq %rax, -0x78(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x3670
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x1110
movq %rax, %rdx
movq -0x78(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x78(%rbp), %rax
movslq -0x34(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x3663
leaq 0x21d8c(%rip), %rdi     # 0x253de
movb $0x0, %al
callq 0x1030
movl $0x1, %edi
callq 0x10f0
jmp 0x3665
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3613
movl $0x1, -0x34(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl -0x1c(%rbp), %r8d
leaq -0x34(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0x3380
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x36f6
movl $0x1, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x36e9
movq -0x8(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x78(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x36ac
jmp 0x36eb
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x369d
movq -0x78(%rbp), %rax
movq -0x50(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq -0x50(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x70(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movq -0x50(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x50(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x14(%rax)
movl $0x0, -0x40(%rbp)
movl $0x1, -0x44(%rbp)
movl $0x2, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x3b1f
movq -0x78(%rbp), %rax
movq -0x50(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq -0x50(%rbp), %rcx
movslq -0x3c(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x78(%rbp), %rax
movq -0x50(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq -0x50(%rbp), %rcx
movl -0x3c(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
addsd (%rax,%rcx,8), %xmm0
movq -0x78(%rbp), %rax
movq -0x50(%rbp), %rcx
movslq -0x3c(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rax
movq -0x50(%rbp), %rcx
movl -0x3c(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd 0x21831(%rip), %xmm1    # 0x25008
divsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x78(%rbp), %rax
movq -0x50(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq -0x50(%rbp), %rcx
movl -0x3c(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x78(%rbp), %rax
movq -0x50(%rbp), %rcx
movslq -0x3c(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rax
movq -0x50(%rbp), %rcx
movl -0x3c(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
addsd (%rax,%rcx,8), %xmm0
movq -0x78(%rbp), %rax
movq -0x50(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq -0x50(%rbp), %rcx
movslq -0x3c(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd 0x217af(%rip), %xmm1    # 0x25008
divsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movl $0x0, -0x34(%rbp)
movsd -0x60(%rbp), %xmm0
movsd 0x21792(%rip), %xmm1    # 0x25010
ucomisd %xmm1, %xmm0
jbe 0x38c6
jmp 0x3886
movsd -0x58(%rbp), %xmm1
movsd -0x60(%rbp), %xmm0
movsd 0x21798(%rip), %xmm2    # 0x25030
subsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x38c4
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movsd -0x58(%rbp), %xmm0
movq -0x70(%rbp), %rax
movslq -0x34(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x58(%rbp)
jmp 0x3886
jmp 0x38d5
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
movl $0x1, -0x34(%rbp)
movl -0x1c(%rbp), %ecx
addl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movsd -0x58(%rbp), %xmm0
subsd -0x60(%rbp), %xmm0
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, 0x8(%rax)
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd 0x216d4(%rip), %xmm0    # 0x25030
ucomisd 0x8(%rax), %xmm0
jbe 0x3984
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd 0x21691(%rip), %xmm0    # 0x25010
movsd %xmm0, 0x8(%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x44(%rbp), %eax
jg 0x3a5d
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %edx
addl -0x38(%rbp), %edx
subl -0x34(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %edx
addl -0x38(%rbp), %edx
subl -0x34(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq -0x70(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
addl -0x38(%rbp), %ecx
subl -0x34(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, 0x8(%rax)
movq -0x70(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsd 0x215df(%rip), %xmm0    # 0x25010
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x3a4d
movq -0x70(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsd 0x215c8(%rip), %xmm0    # 0x25010
movsd %xmm0, (%rax,%rcx,8)
jmp 0x3a4f
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x398d
movl -0x40(%rbp), %eax
addl -0x44(%rbp), %eax
subl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x1c(%rbp), %ecx
addl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x1c(%rbp), %ecx
addl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x50(%rbp), %rax
movl -0x3c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq -0x70(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x60(%rbp), %xmm0
subsd -0x58(%rbp), %xmm0
movq -0x70(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0x68(%rbp), %xmm0
movq -0x70(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x374d
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x44(%rbp), %eax
jg 0x3bb6
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %edx
addl -0x34(%rbp), %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %edx
addl -0x34(%rbp), %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq -0x70(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x30(%rbp), %rax
movl -0x40(%rbp), %ecx
addl -0x34(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, 0x8(%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3b26
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl -0x1c(%rbp), %ecx
shll %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jg 0x3cd9
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm1
movsd 0x21444(%rip), %xmm0    # 0x25030
subsd %xmm0, %xmm1
movaps 0x21489(%rip), %xmm0    # 0x25080
pand %xmm0, %xmm1
movsd 0x2140d(%rip), %xmm0    # 0x25010
ucomisd %xmm1, %xmm0
jb 0x3c20
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rax)
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd 0x21368(%rip), %xmm0    # 0x25010
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x3cc9
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd 0x2134c(%rip), %xmm0    # 0x25010
movsd %xmm0, (%rax,%rcx,8)
jmp 0x3ccb
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3bbd
jmp 0x3cdb
xorl %eax, %eax
cmpl $0x1, -0x7c(%rbp)
movb %al, -0x89(%rbp)
jne 0x3cf6
cmpl $0x0, -0x20(%rbp)
sete %al
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %al
testb $0x1, %al
jne 0x3d05
jmp 0x4036
movl $0x0, -0x7c(%rbp)
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl -0x1c(%rbp), %ecx
shll %ecx
subl $0x3, %ecx
subl -0x80(%rbp), %ecx
cmpl %ecx, %eax
jg 0x4022
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x212cd(%rip), %xmm1    # 0x25010
ucomisd %xmm1, %xmm0
jne 0x4012
jp 0x4012
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
jle 0x4012
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
jle 0x4012
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq -0x10(%rbp), %rcx
movl -0x34(%rbp), %edx
shll %edx
subl $0x1, %edx
movslq %edx, %rdx
cmpq (%rcx,%rdx,8), %rax
jle 0x3def
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x88(%rbp)
jmp 0x3e21
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x88(%rbp)
movl $0x1, -0x7c(%rbp)
movl $0x1, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl -0x1c(%rbp), %ecx
shll %ecx
subl $0x3, %ecx
subl -0x80(%rbp), %ecx
cmpl %ecx, %eax
jg 0x3ed5
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
je 0x3ec5
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x84(%rbp), %rcx
cmpq %rcx, %rax
jne 0x3e88
movslq -0x88(%rbp), %rdx
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x3ec3
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x84(%rbp), %rcx
cmpq %rcx, %rax
jne 0x3ec1
movslq -0x88(%rbp), %rdx
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x3ec3
jmp 0x3ec5
jmp 0x3ec7
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x3e2f
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl -0x1c(%rbp), %ecx
shll %ecx
subl $0x3, %ecx
subl -0x80(%rbp), %ecx
cmpl %ecx, %eax
jg 0x3f6c
movq -0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movl -0x38(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x3edb
movl $0x1, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl -0x1c(%rbp), %ecx
shll %ecx
subl $0x3, %ecx
subl -0x80(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x4010
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x84(%rbp), %rcx
cmpq %rcx, %rax
jle 0x3fc6
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
addq $-0x1, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x84(%rbp), %rcx
cmpq %rcx, %rax
jle 0x4000
movq -0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
addq $-0x1, %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x4002
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x3f73
jmp 0x4022
jmp 0x4014
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3d13
cmpl $0x0, -0x7c(%rbp)
je 0x4031
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x3cdb
movq -0x50(%rbp), %rdi
callq 0x10e0
movq -0x30(%rbp), %rdi
callq 0x10e0
movq -0x70(%rbp), %rdi
callq 0x10e0
movq -0x28(%rbp), %rdi
callq 0x10e0
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x4085
movq -0x78(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x10e0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x4061
movq -0x78(%rbp), %rdi
callq 0x10e0
movl -0x80(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)