// File: dcarrey[P]hgt-detection/./fonctions.cpp
// Function: formatResult(HGT*, int, HGT*, InputTree)
int formatResult(struct HGT *tabHGT,int nbHGT, struct HGT *outHGT,struct InputTree aTree){

	int nbSommet,i,j,nbTrans,sommet,tmp=1,cpt=-1,nbHGTRet=0;
	int racine;
	double max;
	int nbArete = 2*(aTree.size)-3-aTree.kt,sequence=1,sequence_old=0;

	struct DescTree *tabDetect  = (struct DescTree*)malloc((2*(nbHGT+1))*sizeof(struct DescTree));

	//res = fopen(result,"r");

	//==lecture des transferts

	//printf("\nHGT-DETECTION : nombre de HGT avant formatRes %d",nbHGT);
	
	for(i=1;i<=nbHGT;i++){
		
		if(tabHGT[i].valide >= 1){
			nbHGTRet++;
			/*sequence_old = tabHGT[i].sequence;
			
			outHGT[nbHGTRet].valide = 1;
			if(tabHGT[i].sequence != tabHGT[i-1].sequence)
					sequence ++;
			}*/
			
			if(sequence_old == 0){
				sequence = 1;
			}else{
				if(tabHGT[i].sequence != sequence_old){
					sequence ++;
				}
			}
			sequence_old = tabHGT[i].sequence;
			outHGT[nbHGTRet].sequence = sequence;
			
			copyHGT(tabHGT[i],&outHGT[nbHGTRet]);
			cpt++;
			nbSommet = tabDetect[cpt].nbSommet = tabHGT[i].listSource[0];
			
			//printf("\ni=%d",i);
			tabDetect[cpt].Tableau = (int*)malloc(nbSommet*sizeof(int));
			//printf("\n");
			for(j=0;j<nbSommet;j++){
				tabDetect[cpt].Tableau[j] = tabHGT[i].listSource[j+1];
			//	printf("%d ",tabHGT[i].listSource[j+1]);
			}
			//printf("\ni=%d",i);
			//if(i==73) {printf("\nOn sort nbSommet=%d",nbSommet); exit(1);}
			cpt++;
			nbSommet = tabDetect[cpt].nbSommet = tabHGT[i].listDestination[0];
			tabDetect[cpt].Tableau = (int*)malloc(nbSommet*sizeof(int));
			//printf("\n");
			for(j=0;j<nbSommet;j++){
				tabDetect[cpt].Tableau[j] = tabHGT[i].listDestination[j+1];
				//printf("%d ",tabHGT[i].listDestination[j+1]);
			}
		}
		else{
			printf("\nhgt : Transfer %d was found to be idle",i);
		}
	}

	outHGT[nbHGTRet+1].valide=0;
	for(int i=1;i<=nbHGTRet;i++){
		outHGT[i].source_Ar = outHGT[i].source_A;
		outHGT[i].source_Br = outHGT[i].source_B;
		outHGT[i].dest_Ar = outHGT[i].dest_A;
		outHGT[i].dest_Br = outHGT[i].dest_B;
	}
/*
	nbTrans=-1;
	do{
		val=fscanf(res,"%d",&nbSommet);
		if(val != -1){
			printf("<br>");
			nbTrans++;
			tabDetect[nbTrans].nbSommet=nbSommet;
			tabDetect[nbTrans].Tableau = (int*)malloc(nbSommet*sizeof(int));
			for(j=0;j<nbSommet;j++){
				fscanf(res,"%d",&val);
				printf("%d ",val);
				tabDetect[nbTrans].Tableau[j] = val;
			}
		}
	}while(val!=-1);*/
	
	nbTrans = cpt;

//	printf("\n");
	supprimerSousEnsemble(tabDetect,nbTrans);

/*	for(i=0;i<=nbTrans;i++){
		printf("\n");
		for(j=0;j<tabDetect[i].nbSommet;j++){
			printf("%d ",tabDetect[i].Tableau[j]);
		}
	}*/

//	fclose(res);

//	if(addRoot) printf("<br>Racine : %d",n);
//	else  printf("<br>Racine : %d--%d",R1,R2);

	//recherche des aretes au dessus des sous-arbres

//	if(addRoot) racine = n; else racine = R1;

	racine = aTree.Root;
	

	for(i=0;i<=nbTrans;i++){
		max=INFINI;
		sommet=tabDetect[i].Tableau[0];
//		printf("<br> ARETE :"); 
		if(tabDetect[i].nbSommet > 1){
			// calcul de la distance entre la racine et le point d'intersection de tous les sommets
			for(j=1;j<tabDetect[i].nbSommet;j++){
			
				if(max > ( (aTree.ADD[racine][sommet] + aTree.ADD[racine][tabDetect[i].Tableau[j]] - aTree.ADD[sommet][tabDetect[i].Tableau[j]]) / 2.0 ) )
					max = (aTree.ADD[racine][sommet] + aTree.ADD[racine][tabDetect[i].Tableau[j]] - aTree.ADD[sommet][tabDetect[i].Tableau[j]]) / 2.0 ;  
			}
		
			// recherche du sommet
			for(j=1;j<=nbArete;j++){
				if( ((fabs(max - aTree.ADD[racine][aTree.ARETE[2*j-1]]) < 0.00001) && (aTree.ADD[racine][aTree.ARETE[2*j-2]] < aTree.ADD[racine][aTree.ARETE[2*j-1]]) && fabs(aTree.ADD[racine][sommet] - aTree.ADD[racine][aTree.ARETE[2*j-1]] - aTree.ADD[sommet][aTree.ARETE[2*j-1]])< 0.00001) ||
					((fabs(max - aTree.ADD[racine][aTree.ARETE[2*j-2]]) < 0.00001) && (aTree.ADD[racine][aTree.ARETE[2*j-1]] < aTree.ADD[racine][aTree.ARETE[2*j-2]]) && fabs(aTree.ADD[racine][sommet] - aTree.ADD[racine][aTree.ARETE[2*j-2]] - aTree.ADD[sommet][aTree.ARETE[2*j-2]])< 0.00001)  ) {
				
					if( fabs(aTree.ADD[racine][sommet] - aTree.ADD[racine][aTree.ARETE[2*j-1]] - aTree.ADD[aTree.ARETE[2*j-1]][sommet]) < 0.00001 ){		
						if(i % 2 == 0){
							outHGT[tmp].source_A = aTree.ARETE[2*j-1];
							outHGT[tmp].source_B = aTree.ARETE[2*j-2];
						}
						else{
							outHGT[tmp].dest_A = aTree.ARETE[2*j-1];
							outHGT[tmp].dest_B = aTree.ARETE[2*j-2];
							tmp++;
						}
	//					printf(" %d--%d (%d)",ARETE[2*j-1],ARETE[2*j-2],nbTrans);
					}
				}
			}
		}
		else{
			for(j=1;j<=nbArete;j++){
				if((aTree.ARETE[2*j-1] == sommet) || (aTree.ARETE[2*j-2] == sommet)){
					if(i % 2 == 0){
						outHGT[tmp].source_A = aTree.ARETE[2*j-1];
						outHGT[tmp].source_B = aTree.ARETE[2*j-2];
					}
					else{
						outHGT[tmp].dest_A = aTree.ARETE[2*j-1];
						outHGT[tmp].dest_B = aTree.ARETE[2*j-2];
						tmp++;
					}
	//				printf(" %d--%d (%d)",ARETE[2*j-1],ARETE[2*j-2],nbTrans);
				}
					
			}
		}
	}

	for(i=0;i<=cpt;i++){
		free(tabDetect[i].Tableau);
	}
	free(tabDetect);
	
	return nbHGTRet;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
leaq 0x10(%rbp), %rcx
movq %rcx, -0x118(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x1, -0x30(%rbp)
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x38(%rbp)
movl (%rcx), %eax
shll %eax
subl $0x3, %eax
subl 0x48(%rcx), %eax
movl %eax, -0x4c(%rbp)
movl $0x1, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
shll %eax
cltq
imulq $0x18, %rax, %rdi
callq 0x1110
movq %rax, -0x60(%rbp)
movl $0x1, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0xc(%rbp), %eax
jg 0x1d9d5
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
cmpl $0x1, (%rax)
jl 0x1d9b4
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x54(%rbp)
jne 0x1d79e
movl $0x1, -0x50(%rbp)
jmp 0x1d7c6
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl 0x94(%rax), %eax
cmpl -0x54(%rbp), %eax
je 0x1d7c4
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x1d7c6
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl 0x94(%rax), %eax
movl %eax, -0x54(%rbp)
movl -0x50(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq -0x38(%rbp), %rdx
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x94(%rax)
movq -0x8(%rbp), %rsi
movslq -0x20(%rbp), %rax
imulq $0xa8, %rax, %rax
addq %rax, %rsi
leaq -0x108(%rbp), %rdi
movl $0xa8, %edx
callq 0x1070
movq -0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x120(%rbp)
movq %rsp, %rdi
movl $0x15, %ecx
leaq -0x108(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x120(%rbp), %rdi
callq 0x12d90
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
movq -0x60(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl %eax, (%rcx)
movl %eax, -0x1c(%rbp)
movslq -0x1c(%rbp), %rdi
shlq $0x2, %rdi
callq 0x1110
movq %rax, %rcx
movq -0x60(%rbp), %rax
movslq -0x34(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x1d904
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x60(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1d8b5
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movl (%rax), %eax
movq -0x60(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl %eax, (%rcx)
movl %eax, -0x1c(%rbp)
movslq -0x1c(%rbp), %rdi
shlq $0x2, %rdi
callq 0x1110
movq %rax, %rcx
movq -0x60(%rbp), %rax
movslq -0x34(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x1d9b2
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x60(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1d963
jmp 0x1d9c5
movl -0x20(%rbp), %esi
leaq 0x90d1(%rip), %rdi      # 0x26a8f
movb $0x0, %al
callq 0x1030
jmp 0x1d9c7
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1d75f
movq -0x18(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl $0x0, (%rax)
movl $0x1, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jg 0x1daf7
movq -0x18(%rbp), %rax
movslq -0x10c(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl 0x80(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x10c(%rbp), %rdx
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x98(%rax)
movq -0x18(%rbp), %rax
movslq -0x10c(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl 0x84(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x10c(%rbp), %rdx
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x9c(%rax)
movq -0x18(%rbp), %rax
movslq -0x10c(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl 0x88(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x10c(%rbp), %rdx
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xa0(%rax)
movq -0x18(%rbp), %rax
movslq -0x10c(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl 0x8c(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x10c(%rbp), %rdx
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xa4(%rax)
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x1d9fc
movl -0x34(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x60(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x1d690
movq -0x118(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x28(%rbp), %eax
jg 0x1e1e1
movsd 0x74f7(%rip), %xmm0     # 0x25028
movsd %xmm0, -0x48(%rbp)
movq -0x60(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x60(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x1, (%rax)
jle 0x1e083
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x60(%rbp), %rcx
movslq -0x20(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jge 0x1dcab
movq -0x118(%rbp), %rax
movsd -0x48(%rbp), %xmm0
movq 0x8(%rax), %rcx
movslq -0x3c(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x2c(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm1
movq 0x8(%rax), %rcx
movslq -0x3c(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq -0x60(%rbp), %rdx
movslq -0x20(%rbp), %rsi
imulq $0x18, %rsi, %rsi
addq %rsi, %rdx
movq 0x10(%rdx), %rdx
movslq -0x24(%rbp), %rsi
movslq (%rdx,%rsi,4), %rdx
addsd (%rcx,%rdx,8), %xmm1
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x60(%rbp), %rcx
movslq -0x20(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rcx
movslq -0x24(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
subsd (%rax,%rcx,8), %xmm1
movsd 0x7400(%rip), %xmm2     # 0x25008
divsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1dc9b
movq -0x118(%rbp), %rax
movq 0x8(%rax), %rcx
movslq -0x3c(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x2c(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x8(%rax), %rcx
movslq -0x3c(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq -0x60(%rbp), %rdx
movslq -0x20(%rbp), %rsi
imulq $0x18, %rsi, %rsi
addq %rsi, %rdx
movq 0x10(%rdx), %rdx
movslq -0x24(%rbp), %rsi
movslq (%rdx,%rsi,4), %rdx
addsd (%rcx,%rdx,8), %xmm0
movq 0x8(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x60(%rbp), %rcx
movslq -0x20(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rcx
movslq -0x24(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd 0x7376(%rip), %xmm1     # 0x25008
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
jmp 0x1dc9d
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1db6d
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jg 0x1e07e
movq -0x118(%rbp), %rcx
movsd -0x48(%rbp), %xmm1
movq 0x8(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x30(%rcx), %rcx
movl -0x24(%rbp), %edx
shll %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
subsd (%rax,%rcx,8), %xmm1
movaps 0x738b(%rip), %xmm0     # 0x25080
pand %xmm0, %xmm1
movsd 0x732f(%rip), %xmm0     # 0x25030
ucomisd %xmm1, %xmm0
jbe 0x1dde5
movq -0x118(%rbp), %rcx
movq 0x8(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x30(%rcx), %rdx
movl -0x24(%rbp), %esi
shll %esi
subl $0x2, %esi
movslq %esi, %rsi
movq (%rdx,%rsi,8), %rdx
movsd (%rax,%rdx,8), %xmm1
movq 0x8(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x30(%rcx), %rcx
movl -0x24(%rbp), %edx
shll %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1dde5
movq -0x118(%rbp), %rcx
movq 0x8(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movslq -0x2c(%rbp), %rdx
movsd (%rax,%rdx,8), %xmm1
movq 0x8(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x30(%rcx), %rdx
movl -0x24(%rbp), %esi
shll %esi
subl $0x1, %esi
movslq %esi, %rsi
movq (%rdx,%rsi,8), %rdx
subsd (%rax,%rdx,8), %xmm1
movq 0x8(%rcx), %rax
movslq -0x2c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x30(%rcx), %rcx
movl -0x24(%rbp), %edx
shll %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
subsd (%rax,%rcx,8), %xmm1
movaps 0x72b1(%rip), %xmm0     # 0x25080
pand %xmm0, %xmm1
movsd 0x7255(%rip), %xmm0     # 0x25030
ucomisd %xmm1, %xmm0
ja 0x1df0c
movq -0x118(%rbp), %rcx
movsd -0x48(%rbp), %xmm1
movq 0x8(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x30(%rcx), %rcx
movl -0x24(%rbp), %edx
shll %edx
subl $0x2, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
subsd (%rax,%rcx,8), %xmm1
movaps 0x7264(%rip), %xmm0     # 0x25080
pand %xmm0, %xmm1
movsd 0x7208(%rip), %xmm0     # 0x25030
ucomisd %xmm1, %xmm0
jbe 0x1e06e
movq -0x118(%rbp), %rcx
movq 0x8(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x30(%rcx), %rdx
movl -0x24(%rbp), %esi
shll %esi
subl $0x1, %esi
movslq %esi, %rsi
movq (%rdx,%rsi,8), %rdx
movsd (%rax,%rdx,8), %xmm1
movq 0x8(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x30(%rcx), %rcx
movl -0x24(%rbp), %edx
shll %edx
subl $0x2, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1e06e
movq -0x118(%rbp), %rcx
movq 0x8(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movslq -0x2c(%rbp), %rdx
movsd (%rax,%rdx,8), %xmm1
movq 0x8(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x30(%rcx), %rdx
movl -0x24(%rbp), %esi
shll %esi
subl $0x2, %esi
movslq %esi, %rsi
movq (%rdx,%rsi,8), %rdx
subsd (%rax,%rdx,8), %xmm1
movq 0x8(%rcx), %rax
movslq -0x2c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x30(%rcx), %rcx
movl -0x24(%rbp), %edx
shll %edx
subl $0x2, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
subsd (%rax,%rcx,8), %xmm1
movaps 0x718a(%rip), %xmm0     # 0x25080
pand %xmm0, %xmm1
movsd 0x712e(%rip), %xmm0     # 0x25030
ucomisd %xmm1, %xmm0
jbe 0x1e06e
movq -0x118(%rbp), %rcx
movq 0x8(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movslq -0x2c(%rbp), %rdx
movsd (%rax,%rdx,8), %xmm1
movq 0x8(%rcx), %rax
movslq -0x3c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x30(%rcx), %rdx
movl -0x24(%rbp), %esi
shll %esi
subl $0x1, %esi
movslq %esi, %rsi
movq (%rdx,%rsi,8), %rdx
subsd (%rax,%rdx,8), %xmm1
movq 0x8(%rcx), %rax
movq 0x30(%rcx), %rcx
movl -0x24(%rbp), %edx
shll %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm1
movaps 0x7109(%rip), %xmm0     # 0x25080
pand %xmm0, %xmm1
movsd 0x70ad(%rip), %xmm0     # 0x25030
ucomisd %xmm1, %xmm0
jbe 0x1e06c
movl -0x20(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x1e000
movq -0x118(%rbp), %rax
movq 0x30(%rax), %rcx
movl -0x24(%rbp), %edx
shll %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %edx
movq -0x18(%rbp), %rcx
movslq -0x30(%rbp), %rsi
imulq $0xa8, %rsi, %rsi
addq %rsi, %rcx
movl %edx, 0x80(%rcx)
movq 0x30(%rax), %rax
movl -0x24(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rdx
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x84(%rax)
jmp 0x1e06a
movq -0x118(%rbp), %rax
movq 0x30(%rax), %rcx
movl -0x24(%rbp), %edx
shll %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %edx
movq -0x18(%rbp), %rcx
movslq -0x30(%rbp), %rsi
imulq $0xa8, %rsi, %rsi
addq %rsi, %rcx
movl %edx, 0x88(%rcx)
movq 0x30(%rax), %rax
movl -0x24(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rdx
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8c(%rax)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1e06c
jmp 0x1e06e
jmp 0x1e070
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1dcb2
jmp 0x1e1d1
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jg 0x1e1cf
movq -0x118(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x24(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
cmpq %rcx, %rax
je 0x1e0e0
movq -0x118(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x24(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
cmpq %rcx, %rax
jne 0x1e1bf
movl -0x20(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x1e153
movq -0x118(%rbp), %rax
movq 0x30(%rax), %rcx
movl -0x24(%rbp), %edx
shll %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %edx
movq -0x18(%rbp), %rcx
movslq -0x30(%rbp), %rsi
imulq $0xa8, %rsi, %rsi
addq %rsi, %rcx
movl %edx, 0x80(%rcx)
movq 0x30(%rax), %rax
movl -0x24(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rdx
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x84(%rax)
jmp 0x1e1bd
movq -0x118(%rbp), %rax
movq 0x30(%rax), %rcx
movl -0x24(%rbp), %edx
shll %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %edx
movq -0x18(%rbp), %rcx
movslq -0x30(%rbp), %rsi
imulq $0xa8, %rsi, %rsi
addq %rsi, %rcx
movl %edx, 0x88(%rcx)
movq 0x30(%rax), %rax
movl -0x24(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rdx
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8c(%rax)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1e1bf
jmp 0x1e1c1
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1e08a
jmp 0x1e1d1
jmp 0x1e1d3
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1db1d
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x34(%rbp), %eax
jg 0x1e213
movq -0x60(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
callq 0x10e0
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1e1e8
movq -0x60(%rbp), %rdi
callq 0x10e0
movl -0x38(%rbp), %eax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopl (%rax,%rax)