// File: /workspace/github_cpp_makefile_star2_O2/dcarrey[P]hgt-detection/./fonctions.cpp
// Function: applyHGT(double**, InputTree*, int, int)
void applyHGT(double**ref,struct InputTree * aTree,int i,int j){
	
	int nodeToDel,otherNode,neighbor1=0,neighbor2=0,p,q,branch1=0,branch2=0,newNode;
	int nouveauNoeud;
	double tailleBrancheSource,tailleTransfert;
	int Ssup,Sinf,Sdestination;
	int kt = aTree->kt;
	int iternumber=100;

	if(i==0 || j==0) { printf("\ntransfert impossible"); exit(-1);}
	double ** DIST = (double**)malloc(2*aTree->size*(sizeof(double*)));
	for(p=0;p<2*aTree->size;p++)
		DIST[p] = (double *)malloc(2*aTree->size*(sizeof(double)));

  //= copie du contenue de ADD dans DIST
	for(p=1;p<=2*aTree->size-2-kt;p++)	
		for(q=1;q<=2*aTree->size-2-kt;q++)
			DIST[p][q] = aTree->ADD[p][q];
	
	//= recherche des sommets superieurs et inferieurs sources
	tailleBrancheSource = aTree->LONGUEUR[i];
	if ( aTree->ADD[aTree->ARETE[2*i-1]][aTree->Root] < aTree->ADD[aTree->ARETE[2*i-2]][aTree->Root]){
			Ssup = aTree->ARETE[2*i-1];
			Sinf = aTree->ARETE[2*i-2];
	}
	else{
			Ssup = aTree->ARETE[2*i-2];
			Sinf = aTree->ARETE[2*i-1];
	}
	
	//= recherche des sommets superieurs et inferieurs destinations
	if(aTree->ADD[aTree->ARETE[2*j-1]][aTree->Root] < aTree->ADD[aTree->ARETE[2*j-2]][aTree->Root])
	{nodeToDel = aTree->ARETE[2*j-1]; otherNode = Sdestination = aTree->ARETE[2*j-2];}
	else
	{nodeToDel = aTree->ARETE[2*j-2]; otherNode = Sdestination = aTree->ARETE[2*j-1];}

	//= cas d'un noeud binaire, on va deplacer le noeud superieur (nodeToDel)
	if(aTree->degre[nodeToDel] == 3){
		//== 1. recherche des voisins du noeud a supprimer
		for(p=1;p<=2*(aTree->size)-3-aTree->kt;p++){
			if(aTree->ARETE[2*p-1] == nodeToDel && aTree->ARETE[2*p-2] != otherNode){
				if(neighbor1==0){neighbor1 = aTree->ARETE[2*p-2]; branch1=p;}
				else {neighbor2 = aTree->ARETE[2*p-2]; branch2=p;}
			} 
			if(aTree->ARETE[2*p-2] == nodeToDel && aTree->ARETE[2*p-1] != otherNode){
				if(neighbor1==0){neighbor1 = aTree->ARETE[2*p-1]; branch1=p;}
				else {neighbor2 = aTree->ARETE[2*p-1]; branch2=p;}
			} 
		}
		if(aTree->LONGUEUR[i-1] <= 2*5*epsilon){
		//printf("icit");
			for(p=1;p<=2*aTree->size-2-aTree->kt;p++)
				for(q=p+1;q<=2*aTree->size-2-aTree->kt;q++){
					if((fabs(DIST[p][q] - DIST[p][aTree->ARETE[2*i-1]] - aTree->LONGUEUR[i-1] - DIST[aTree->ARETE[2*i-2]][q]) < 2*epsilon) ||
					   (fabs(DIST[p][q] - DIST[p][aTree->ARETE[2*i-2]] - aTree->LONGUEUR[i-1] - DIST[aTree->ARETE[2*i-1]][q]) < 2*epsilon) )
					{
					  if((DIST[p][aTree->ARETE[2*i-1]]+DIST[aTree->ARETE[2*i-2]][q]) <(DIST[p][aTree->ARETE[2*i-2]]+DIST[aTree->ARETE[2*i-1]][q])){ 
						  aTree->ADD[p][q] = aTree->ADD[q][p] = DIST[p][q] = DIST[q][p] = DIST[p][aTree->ARETE[2*i-1]]+DIST[aTree->ARETE[2*i-2]][q] + 2*5*epsilon;
						}
						else{
               aTree->ADD[p][q] = aTree->ADD[q][p] = DIST[p][q] = DIST[q][p] = DIST[p][aTree->ARETE[2*i-2]]+DIST[aTree->ARETE[2*i-1]][q] + 2*5*epsilon;
            }
					}
				}
		}
		
		//== 3. branch1 is used to connect the two neighbors
		aTree->ARETE[2*branch1-1] = neighbor1;
		aTree->ARETE[2*branch1-2] = neighbor2;
		aTree->LONGUEUR[branch1-1]= aTree->LONGUEUR[branch1-1] + aTree->LONGUEUR[branch2-1];

		//== 4. branch2 is used to connect one of the source node (i)
		aTree->ARETE[2*branch2-1] = aTree->ARETE[2*i-1];
		aTree->ARETE[2*branch2-2] = nodeToDel;
		aTree->LONGUEUR[branch2-1]= (aTree->LONGUEUR[i-1]/2.0 > 5*epsilon)?aTree->LONGUEUR[i-1]/2.0:5*epsilon;

		//== 5. branch i is used to connect the other source node (i)
		aTree->ARETE[2*i-1] = aTree->ARETE[2*i-2];
		aTree->ARETE[2*i-2] = nodeToDel;
		aTree->LONGUEUR[i-1]= (aTree->LONGUEUR[i-1]/2.0 > 5*epsilon)?aTree->LONGUEUR[i-1]/2.0:5*epsilon;
		nouveauNoeud = nodeToDel;

		for(p=1;p<=2*aTree->size-2-aTree->kt;p++){
			
			if (fabs(DIST[p][aTree->Root] - DIST[p][Sdestination] - DIST[Sdestination][aTree->Root]) < 3*epsilon	){
			 //printf("\n==%d,%d,%d",p,Sdestination,nodeToDel);
      	aTree->ADD[nodeToDel][p] = aTree->ADD[p][nodeToDel] = 1.0 + DIST[Sdestination][p];
			}
			else	{
			  if(DIST[p][Ssup] < DIST[p][Sinf]){
				  aTree->ADD[nodeToDel][p] = aTree->ADD[p][nodeToDel] = DIST[p][Ssup] + aTree->LONGUEUR[i-1];
				}
				else{
          aTree->ADD[nodeToDel][p] = aTree->ADD[p][nodeToDel] = DIST[p][Sinf] + aTree->LONGUEUR[i-1];
        }
			}
		}
		
		aTree->ADD[nodeToDel][nodeToDel] = 0.0;
		tailleBrancheSource = aTree->LONGUEUR[i-1];
		tailleTransfert = 1.0; 
		aTree->LONGUEUR[j-1]=1.0;
		nouveauNoeud=nodeToDel;
	}
	//= noeud de degre > a 3
	else{
		if(aTree->LONGUEUR[i-1] <= 2*5*epsilon){
			for(p=1;p<=2*aTree->size-2-aTree->kt;p++)
				for(q=p+1;q<=2*aTree->size-2-aTree->kt;q++){
					if((fabs(DIST[p][q] - DIST[p][aTree->ARETE[2*i-1]] - aTree->LONGUEUR[i-1] - DIST[aTree->ARETE[2*i-2]][q]) < 2*epsilon) ||
					   (fabs(DIST[p][q] - DIST[p][aTree->ARETE[2*i-2]] - aTree->LONGUEUR[i-1] - DIST[aTree->ARETE[2*i-1]][q]) < 2*epsilon) )
					{
					   if((DIST[p][aTree->ARETE[2*i-1]]+DIST[aTree->ARETE[2*i-2]][q]) < (DIST[p][aTree->ARETE[2*i-2]]+DIST[aTree->ARETE[2*i-1]][q])){
						    aTree->ADD[p][q] = aTree->ADD[q][p] = DIST[p][q] = DIST[q][p] = DIST[p][aTree->ARETE[2*i-1]]+DIST[aTree->ARETE[2*i-2]][q] + 2*5*epsilon;
						 }
						 else{
                aTree->ADD[p][q] = aTree->ADD[q][p] = DIST[p][q] = DIST[q][p] = DIST[p][aTree->ARETE[2*i-2]]+DIST[aTree->ARETE[2*i-1]][q] + 2*5*epsilon;
             }
					}
				}
		}
		
		//== 2. Ajouter un nouveau noeud sur la branche i (ajout d'une nouvelle arete)
		newNode = nouveauNoeud = 2*aTree->size-2-aTree->kt+1;

		double lt = (aTree->LONGUEUR[i-1]/2.0 >= 5*epsilon)?aTree->LONGUEUR[i-1]/2.0:5*epsilon;
		//== 4. connecter le nouveau noeud
		aTree->ARETE[2*j-1]=newNode;
		aTree->ARETE[2*j-2]=otherNode;
		aTree->LONGUEUR[j-1]= 1.0;

		//== 5. connecter la nouvelle arete
		aTree->ARETE[2*(2*aTree->size-3-aTree->kt+1)-1] = aTree->ARETE[2*i-1];
		aTree->ARETE[2*(2*aTree->size-3-aTree->kt+1)-2] = newNode;
		aTree->LONGUEUR[(2*aTree->size-3-aTree->kt+1)-1]= lt; //1.0;

		aTree->ARETE[2*i-1] = aTree->ARETE[2*i-2];
		aTree->ARETE[2*i-2] = newNode;
		aTree->LONGUEUR[i-1]= lt; //1.0;

		aTree->degre[newNode] = 3;
		aTree->degre[nodeToDel]--;
		aTree->kt--;
		
		for(p=1;p<=newNode;p++){
			if (fabs(DIST[p][aTree->Root] - DIST[p][Sdestination] - DIST[Sdestination][aTree->Root]) < 3*epsilon	){
				aTree->ADD[newNode][p] = aTree->ADD[p][newNode] = 1.0 + DIST[Sdestination][p];
			}
			else	{
				if((DIST[p][Ssup] + lt) < (DIST[p][Sinf] + lt)){
          aTree->ADD[newNode][p] = aTree->ADD[p][newNode] = DIST[p][Ssup] + lt;
        }
        else{
          aTree->ADD[newNode][p] = aTree->ADD[p][newNode] = DIST[p][Sinf] + lt;
        }
			}
		}	
	
		
		
		aTree->ADD[newNode][newNode] = 0.0;
		tailleBrancheSource = lt;
		tailleTransfert=1.0;
	}
	
	//== Mise a jour des distances
	/*int tab_noeud1[2*aTree->size];
	int tab_noeud2[2*aTree->size];*/
	
	int nbNoeud1=0;
	int nbNoeud2=0;
	int * tab_noeud1 = (int*)malloc((2*aTree->size+1)*sizeof(int));
	int * tab_noeud2 = (int*)malloc((2*aTree->size+1)*sizeof(int));
	
  //== liste des noeuds sous sDestination
  
	for(int i=1;i<2*aTree->size-2-aTree->kt;i++){
      if( fabs(DIST[i][aTree->size]-DIST[i][Sdestination] - DIST[Sdestination][aTree->size]) < 5*epsilon ){
        tab_noeud1[nbNoeud1++] = i;
        //printf("\n1--%d",i);
      }
      else{
        tab_noeud2[nbNoeud2++] = i;
       // printf("\n2--%d",i);
      }
  }  
    //== mise a jour des distances
  	for(int i=0;i<nbNoeud1;i++){
      for(int j=0;j<nbNoeud2;j++){
        aTree->ADD[tab_noeud1[i]][tab_noeud2[j]] =  aTree->ADD[tab_noeud2[j]][tab_noeud1[i]] = aTree->ADD[tab_noeud2[j]][nouveauNoeud] + tailleTransfert + aTree->ADD[Sdestination ][tab_noeud1[i]];
      }
    }
  	
	kt = aTree->kt;
	
  loadAdjacenceMatrix(aTree->Adjacence,aTree->ARETE, aTree->LONGUEUR,aTree->size, aTree->kt);

	for(p=0;p<2*aTree->size;p++)
		free(DIST[p]);
	free(DIST);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, -0x30(%rbp)
testl %edx, %edx
je 0x8938
testl %ecx, %ecx
je 0x8938
movq %rcx, -0x80(%rbp)
movl 0x48(%rsi), %eax
movl %eax, -0x3c(%rbp)
movq %rsi, -0x60(%rbp)
movslq (%rsi), %r15
leal (%r15,%r15), %ebx
movq %r15, -0x98(%rbp)
shlq $0x4, %r15
movq %r15, %rdi
callq 0x1130
movq %rax, %r14
xorl %r12d, %r12d
testl %ebx, %ebx
movl $0x0, %r13d
movl %ebx, -0x38(%rbp)
cmovgl %ebx, %r13d
cmpq %r12, %r13
je 0x80c9
movq %r15, %rdi
callq 0x1130
movq %rax, (%r14,%r12,8)
incq %r12
jmp 0x80b3
movl -0x38(%rbp), %ecx
movl %ecx, %r11d
movl -0x3c(%rbp), %eax
subl %eax, %r11d
leal -0x2(%r11), %r8d
movl %eax, %esi
notl %esi
addl %ecx, %esi
xorl %eax, %eax
testl %r8d, %r8d
cmovgl %r8d, %eax
movq %rax, -0xa8(%rbp)
leal 0x1(%rax), %r10d
pushq $0x1
popq %rax
movq %rax, %rcx
movq -0x60(%rbp), %r9
cmpq %r10, %rcx
je 0x812a
movq %rax, %rdx
cmpq %rdx, %rsi
je 0x8125
movq 0x8(%r9), %rdi
movq (%rdi,%rcx,8), %rdi
movsd (%rdi,%rdx,8), %xmm0
movq (%r14,%rcx,8), %rdi
movsd %xmm0, (%rdi,%rdx,8)
incq %rdx
jmp 0x8105
incq %rcx
jmp 0x80fd
movq %r11, -0x48(%rbp)
movq %r10, -0xa0(%rbp)
movq 0x8(%r9), %r15
movq 0x30(%r9), %rdx
movq -0x30(%rbp), %rax
addl %eax, %eax
movslq %eax, %r13
movq -0x10(%rdx,%r13,8), %r11
movq -0x8(%rdx,%r13,8), %r12
movq (%r15,%r12,8), %rax
movslq 0x20(%r9), %rbx
movq (%r15,%r11,8), %rcx
movsd (%rcx,%rbx,8), %xmm0
ucomisd (%rax,%rbx,8), %xmm0
movq %r11, %rax
cmovaq %r12, %rax
movq %rax, -0x88(%rbp)
movq %r12, %r10
cmovaq %r11, %r10
movq -0x80(%rbp), %rax
leal (%rax,%rax), %eax
movslq %eax, %rcx
movq -0x10(%rdx,%rcx,8), %rax
movq %rdx, -0x68(%rbp)
movq %rcx, -0x58(%rbp)
movq -0x8(%rdx,%rcx,8), %rdi
movq (%r15,%rax,8), %rcx
movsd (%rcx,%rbx,8), %xmm0
movq (%r15,%rdi,8), %rcx
movq %rbx, -0xb0(%rbp)
ucomisd (%rcx,%rbx,8), %xmm0
movq %rdi, %rdx
cmovaq %rax, %rdx
cmovbeq %rax, %rdi
movq 0x50(%r9), %rbx
movslq %edi, %rax
movq %rax, -0x50(%rbp)
cmpl $0x3, (%rbx,%rax,4)
movslq -0x30(%rbp), %rcx
jne 0x82a9
movq %r13, -0x70(%rbp)
movq %r10, -0x78(%rbp)
movq %rdi, -0x90(%rbp)
movq -0x48(%rbp), %rbx
addl $-0x3, %ebx
movq %rdx, %r13
shlq $0x20, %r13
movslq %edx, %rax
movq %rax, -0x30(%rbp)
xorl %esi, %esi
testl %ebx, %ebx
cmovlel %esi, %ebx
shlq $0x4, %rbx
pushq $0x1
popq %rdx
movq $0x0, -0x58(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x34(%rbp)
xorl %r10d, %r10d
cmpq %rsi, %rbx
je 0x83bb
movq -0x68(%rbp), %rax
movq (%rax,%rsi), %r9
movq 0x8(%rax,%rsi), %rdi
cmpq -0x50(%rbp), %rdi
jne 0x826e
movq -0x30(%rbp), %rax
cmpq %rax, %r9
jne 0x8249
movq %rax, %r9
jmp 0x826e
testl %r10d, %r10d
movq -0x58(%rbp), %rax
cmovel %edx, %eax
movq %rax, -0x58(%rbp)
movl -0x48(%rbp), %eax
cmovnel %edx, %eax
movl %eax, -0x48(%rbp)
movl -0x34(%rbp), %eax
cmovnel %r9d, %eax
movl %eax, -0x34(%rbp)
cmovel %r9d, %r10d
cmpq -0x50(%rbp), %r9
jne 0x829e
cmpq -0x30(%rbp), %rdi
je 0x829e
testl %r10d, %r10d
movq -0x58(%rbp), %rax
cmovel %edx, %eax
movq %rax, -0x58(%rbp)
movl -0x48(%rbp), %eax
cmovnel %edx, %eax
movl %eax, -0x48(%rbp)
movl -0x34(%rbp), %eax
cmovnel %edi, %eax
movl %eax, -0x34(%rbp)
cmovel %edi, %r10d
addq $0x10, %rsi
incl %edx
jmp 0x821f
movq %rbx, -0x30(%rbp)
movq 0x38(%r9), %rbx
movsd -0x8(%rbx,%rcx,8), %xmm0
movsd 0xbd99(%rip), %xmm1     # 0x14058
ucomisd %xmm0, %xmm1
jb 0x8570
movq %r13, -0x70(%rbp)
movq %r10, -0x78(%rbp)
pushq $0x1
popq %r13
xorl %r10d, %r10d
movapd 0xbda0(%rip), %xmm0     # 0x14080
movsd 0xbd28(%rip), %xmm2     # 0x14010
cmpq -0xa0(%rbp), %r13
je 0x8562
movq %r10, %rdi
leal 0x2(%rdi), %eax
cmpl %eax, %r8d
jl 0x83b0
movq (%r14,%r13,8), %r9
movsd 0x10(%r9,%rdi,8), %xmm6
movsd (%r9,%r12,8), %xmm3
movapd %xmm6, %xmm5
subsd %xmm3, %xmm5
movsd -0x8(%rbx,%rcx,8), %xmm7
subsd %xmm7, %xmm5
movq (%r14,%r11,8), %rax
movsd 0x10(%rax,%rdi,8), %xmm4
subsd %xmm4, %xmm5
andpd %xmm0, %xmm5
ucomisd %xmm5, %xmm2
movsd (%r9,%r11,8), %xmm5
jbe 0x8351
movq (%r14,%r12,8), %rax
movsd 0x10(%rax,%rdi,8), %xmm7
jmp 0x8371
subsd %xmm5, %xmm6
subsd %xmm7, %xmm6
movq (%r14,%r12,8), %rax
movsd 0x10(%rax,%rdi,8), %xmm7
subsd %xmm7, %xmm6
andpd %xmm0, %xmm6
ucomisd %xmm6, %xmm2
jbe 0x83a8
addsd %xmm4, %xmm3
addsd %xmm7, %xmm5
minsd %xmm5, %xmm3
movq 0x10(%r14,%rdi,8), %rax
addsd %xmm1, %xmm3
movsd %xmm3, (%rax,%r13,8)
movsd %xmm3, 0x10(%r9,%rdi,8)
movq 0x10(%r15,%rdi,8), %rax
movsd %xmm3, (%rax,%r13,8)
movq (%r15,%r13,8), %rax
movsd %xmm3, 0x10(%rax,%rdi,8)
incq %rdi
jmp 0x82f8
incq %r13
incq %r10
jmp 0x82e8
movq -0x60(%rbp), %rax
movq 0x38(%rax), %rbx
movsd 0xbc8d(%rip), %xmm0     # 0x14058
ucomisd -0x8(%rbx,%rcx,8), %xmm0
jae 0x8851
movslq %r10d, %rax
movq -0x58(%rbp), %rsi
leal (%rsi,%rsi), %edx
movslq %edx, %rdx
movq -0x68(%rbp), %rdi
movq %rax, -0x8(%rdi,%rdx,8)
movslq -0x34(%rbp), %rax
movq %rax, -0x10(%rdi,%rdx,8)
movslq %esi, %rax
movsd -0x8(%rbx,%rax,8), %xmm0
movslq -0x48(%rbp), %rdx
addsd -0x8(%rbx,%rdx,8), %xmm0
movsd %xmm0, -0x8(%rbx,%rax,8)
movq -0x70(%rbp), %r8
movq -0x8(%rdi,%r8,8), %rax
leal (%rdx,%rdx), %esi
movslq %esi, %rsi
movq %rax, -0x8(%rdi,%rsi,8)
movq -0x50(%rbp), %r12
movq %r12, -0x10(%rdi,%rsi,8)
movsd 0xbbd4(%rip), %xmm0     # 0x14008
movsd -0x8(%rbx,%rcx,8), %xmm1
mulsd %xmm0, %xmm1
movsd 0xbbfa(%rip), %xmm2     # 0x14040
maxsd %xmm2, %xmm1
movsd %xmm1, -0x8(%rbx,%rdx,8)
movq -0x10(%rdi,%r8,8), %rax
movq %rax, -0x8(%rdi,%r8,8)
movq %r12, -0x10(%rdi,%r8,8)
mulsd -0x8(%rbx,%rcx,8), %xmm0
maxsd %xmm2, %xmm0
movsd %xmm0, -0x8(%rbx,%rcx,8)
movslq -0x88(%rbp), %rdx
shlq $0x3, %rdx
movslq -0x78(%rbp), %rsi
shlq $0x3, %rsi
movl -0xa8(%rbp), %edi
xorl %r8d, %r8d
movapd 0xbbed(%rip), %xmm0     # 0x14080
movsd 0xbbc5(%rip), %xmm1     # 0x14060
movsd 0xbbc5(%rip), %xmm2     # 0x14068
movq -0x30(%rbp), %r11
cmpq %r8, %rdi
je 0x853e
movq 0x8(%r14,%r8,8), %r9
movq -0xb0(%rbp), %rax
movsd (%r9,%rax,8), %xmm3
subsd (%r9,%r11,8), %xmm3
movq (%r14,%r11,8), %r10
subsd (%r10,%rax,8), %xmm3
andpd %xmm0, %xmm3
ucomisd %xmm3, %xmm1
jbe 0x84f4
movsd 0x8(%r10,%r8,8), %xmm3
addsd %xmm2, %xmm3
movq 0x8(%r15,%r8,8), %rax
movsd %xmm3, (%rax,%r12,8)
jmp 0x852b
movsd (%r9,%rdx), %xmm3
movsd (%r9,%rsi), %xmm4
ucomisd %xmm3, %xmm4
movsd -0x8(%rbx,%rcx,8), %xmm5
movq 0x8(%r15,%r8,8), %r9
jbe 0x851d
addsd %xmm5, %xmm3
movsd %xmm3, (%r9,%r12,8)
jmp 0x852b
addsd %xmm5, %xmm4
movsd %xmm4, (%r9,%r12,8)
movapd %xmm4, %xmm3
movq (%r15,%r12,8), %rax
movsd %xmm3, 0x8(%rax,%r8,8)
incq %r8
jmp 0x84a7
movq (%r15,%r12,8), %rax
andq $0x0, (%rax,%r12,8)
movslq -0x80(%rbp), %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, -0x8(%rbx,%rax,8)
movl -0x38(%rbp), %eax
jmp 0x86ed
movsd -0x8(%rbx,%rcx,8), %xmm0
movq -0x78(%rbp), %r10
movq -0x70(%rbp), %r13
movq -0x48(%rbp), %r11
leal -0x1(%r11), %eax
movq %rax, -0x90(%rbp)
movslq %eax, %r8
movq -0x68(%rbp), %r9
movq -0x58(%rbp), %rax
movq %r8, -0x8(%r9,%rax,8)
movslq %edx, %r12
movq %r12, -0x10(%r9,%rax,8)
movslq -0x80(%rbp), %rax
movabsq $0x3ff0000000000000, %rdi # imm = 0x3FF0000000000000
movq %rdi, -0x8(%rbx,%rax,8)
movq -0x8(%r9,%r13,8), %rax
leal -0x5(%r11,%r11), %edi
movslq %edi, %rdi
movq %rax, (%r9,%rdi,8)
mulsd 0xba45(%rip), %xmm0     # 0x14008
maxsd 0xba75(%rip), %xmm0     # 0x14040
leal -0x6(,%r11,2), %eax
cltq
movq %r8, (%r9,%rax,8)
addl $-0x3, %r11d
movslq %r11d, %rax
movsd %xmm0, (%rbx,%rax,8)
movq -0x10(%r9,%r13,8), %rax
movq %rax, -0x8(%r9,%r13,8)
movq %r8, -0x10(%r9,%r13,8)
movsd %xmm0, -0x8(%rbx,%rcx,8)
movq -0x30(%rbp), %rcx
movl $0x3, (%rcx,%r8,4)
movq -0x50(%rbp), %rax
decl (%rcx,%rax,4)
movq %rdx, %r13
shlq $0x20, %r13
movq -0x60(%rbp), %r11
movl 0x48(%r11), %edi
decl %edi
movslq -0x88(%rbp), %rax
shlq $0x3, %rax
movslq %r10d, %rcx
shlq $0x3, %rcx
xorl %edx, %edx
testl %esi, %esi
cmovlel %edx, %esi
movl %edi, -0x3c(%rbp)
movl %edi, 0x48(%r11)
movapd 0xba3a(%rip), %xmm1     # 0x14080
movsd 0xba12(%rip), %xmm2     # 0x14060
movsd 0xba12(%rip), %xmm3     # 0x14068
cmpq %rdx, %rsi
je 0x86d4
movq 0x8(%r14,%rdx,8), %rdi
movslq 0x20(%r11), %r10
movsd (%rdi,%r10,8), %xmm4
subsd (%rdi,%r12,8), %xmm4
movq (%r14,%r12,8), %r9
subsd (%r9,%r10,8), %xmm4
andpd %xmm1, %xmm4
ucomisd %xmm4, %xmm2
jbe 0x8696
movsd 0x8(%r9,%rdx,8), %xmm4
addsd %xmm3, %xmm4
movq 0x8(%r15,%rdx,8), %rdi
jmp 0x86b3
movsd (%rdi,%rax), %xmm4
addsd %xmm0, %xmm4
movsd (%rdi,%rcx), %xmm5
addsd %xmm0, %xmm5
ucomisd %xmm4, %xmm5
movq 0x8(%r15,%rdx,8), %rdi
jbe 0x86bb
movsd %xmm4, (%rdi,%r8,8)
jmp 0x86c5
movsd %xmm5, (%rdi,%r8,8)
movapd %xmm5, %xmm4
movq (%r15,%r8,8), %rdi
movsd %xmm4, 0x8(%rdi,%rdx,8)
incq %rdx
jmp 0x8656
movq %r12, -0x30(%rbp)
movq (%r15,%r8,8), %rax
andq $0x0, (%rax,%r8,8)
movl (%r11), %eax
movq %rax, -0x98(%rbp)
addl %eax, %eax
movl %eax, -0x38(%rbp)
orl $0x1, %eax
movslq %eax, %rdi
shlq $0x2, %rdi
movq %rdi, -0x50(%rbp)
callq 0x1130
movq %rax, %r12
movq -0x50(%rbp), %rdi
callq 0x1130
movl -0x38(%rbp), %ecx
subl -0x3c(%rbp), %ecx
addl $-0x2, %ecx
movl %ecx, %edx
movq -0x98(%rbp), %rcx
movslq %ecx, %rsi
movslq %edx, %rdi
xorl %r11d, %r11d
pushq $0x1
popq %r8
movapd 0xb94a(%rip), %xmm0     # 0x14080
movsd 0xb902(%rip), %xmm1     # 0x14040
xorl %edx, %edx
cmpq %rdi, %r8
jge 0x878c
movq (%r14,%r8,8), %r9
movsd (%r9,%rsi,8), %xmm2
movq -0x30(%rbp), %r10
subsd (%r9,%r10,8), %xmm2
movq (%r14,%r10,8), %r9
subsd (%r9,%rsi,8), %xmm2
andpd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
jbe 0x8778
movl %r11d, %r9d
incl %r11d
movq %r12, %r10
jmp 0x8780
movl %edx, %r9d
incl %edx
movq %rax, %r10
movslq %r9d, %r9
movl %r8d, (%r10,%r9,4)
incq %r8
jmp 0x8740
movq %rbx, -0x50(%rbp)
movslq -0x90(%rbp), %rsi
sarq $0x1d, %r13
xorl %edi, %edi
testl %edx, %edx
cmovlel %edi, %edx
testl %r11d, %r11d
cmovlel %edi, %r11d
movq %r11, -0x30(%rbp)
movsd 0xb8b3(%rip), %xmm0     # 0x14068
cmpq -0x30(%rbp), %rdi
je 0x8803
movq %rcx, %rbx
xorl %r8d, %r8d
cmpq %r8, %rdx
je 0x87fb
movslq (%rax,%r8,4), %r9
movq (%r15,%r9,8), %r10
movsd (%r10,%rsi,8), %xmm1
addsd %xmm0, %xmm1
movq (%r15,%r13), %r11
movslq (%r12,%rdi,4), %rcx
addsd (%r11,%rcx,8), %xmm1
movsd %xmm1, (%r10,%rcx,8)
movq (%r15,%rcx,8), %rcx
movsd %xmm1, (%rcx,%r9,8)
incq %r8
jmp 0x87c1
incq %rdi
movq %rbx, %rcx
jmp 0x87b5
movq -0x60(%rbp), %rbx
movq 0x28(%rbx), %rdi
movq -0x68(%rbp), %rsi
movq -0x50(%rbp), %rdx
movl -0x3c(%rbp), %r8d
callq 0x20bd
xorl %r15d, %r15d
movslq (%rbx), %rax
addq %rax, %rax
cmpq %rax, %r15
jge 0x8838
movq (%r14,%r15,8), %rdi
callq 0x10f0
incq %r15
jmp 0x881f
movq %r14, %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10f0
pushq $0x1
popq %rdx
xorl %edi, %edi
movapd 0xb822(%rip), %xmm1     # 0x14080
movsd 0xb7aa(%rip), %xmm2     # 0x14010
cmpq -0xa0(%rbp), %rdx
je 0x83d7
movq %rdi, %rsi
leal 0x2(%rsi), %r9d
cmpl %r9d, %r8d
jl 0x892d
movq (%r14,%rdx,8), %r9
movsd 0x10(%r9,%rsi,8), %xmm6
movsd (%r9,%r12,8), %xmm3
movapd %xmm6, %xmm5
subsd %xmm3, %xmm5
movsd -0x8(%rbx,%rcx,8), %xmm7
subsd %xmm7, %xmm5
movq (%r14,%r11,8), %rax
movsd 0x10(%rax,%rsi,8), %xmm4
subsd %xmm4, %xmm5
andpd %xmm1, %xmm5
ucomisd %xmm5, %xmm2
movsd (%r9,%r11,8), %xmm5
jbe 0x88d0
movq (%r14,%r12,8), %rax
movsd 0x10(%rax,%rsi,8), %xmm7
jmp 0x88f0
subsd %xmm5, %xmm6
subsd %xmm7, %xmm6
movq (%r14,%r12,8), %rax
movsd 0x10(%rax,%rsi,8), %xmm7
subsd %xmm7, %xmm6
andpd %xmm1, %xmm6
ucomisd %xmm6, %xmm2
jbe 0x8925
addsd %xmm4, %xmm3
addsd %xmm7, %xmm5
minsd %xmm5, %xmm3
movq 0x10(%r14,%rsi,8), %rax
addsd %xmm0, %xmm3
movsd %xmm3, (%rax,%rdx,8)
movsd %xmm3, 0x10(%r9,%rsi,8)
movq 0x10(%r15,%rsi,8), %rax
movsd %xmm3, (%rax,%rdx,8)
movq (%r15,%rdx,8), %rax
movsd %xmm3, 0x10(%rax,%rsi,8)
incq %rsi
jmp 0x8876
incq %rdx
incq %rdi
jmp 0x8866
leaq 0xbff7(%rip), %rdi      # 0x14936
xorl %eax, %eax
callq 0x1030
pushq $-0x1
popq %rdi
callq 0x1100