// File: /workspace/github_cpp_makefile_star2_O3/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 $0x98, %rsp
movq %rdx, -0x60(%rbp)
testl %edx, %edx
je 0x96d0
testl %ecx, %ecx
je 0x96d0
movq %rcx, -0x80(%rbp)
movl 0x48(%rsi), %r13d
movq %rsi, -0x78(%rbp)
movslq (%rsi), %rbx
leal (%rbx,%rbx), %eax
movq %rax, -0x38(%rbp)
movq %rbx, %r15
shlq $0x4, %r15
movq %r15, %rdi
callq 0x1140
movq %rax, %r14
movq %rbx, -0x88(%rbp)
testq %rbx, %rbx
jle 0x8dc4
movl -0x38(%rbp), %ebx
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x1140
movq %rax, (%r14,%r12,8)
incq %r12
cmpq %r12, %rbx
jne 0x8db0
movq -0x38(%rbp), %r15
movl %r15d, %eax
subl %r13d, %eax
movq %rax, -0x48(%rbp)
leal -0x2(%rax), %esi
testl %esi, %esi
movq -0x78(%rbp), %r12
jle 0x8e19
movl %r13d, %eax
notl %eax
addl %r15d, %eax
movq 0x8(%r12), %rcx
movl $0x1, %edx
movq (%rcx,%rdx,8), %rdi
movq (%r14,%rdx,8), %r8
movl $0x1, %r9d
movsd (%rdi,%r9,8), %xmm0
movsd %xmm0, (%r8,%r9,8)
incq %r9
cmpq %r9, %rax
jne 0x8dfd
incq %rdx
cmpq %rax, %rdx
jne 0x8def
movq 0x8(%r12), %rbx
movq 0x30(%r12), %rdx
movq -0x60(%rbp), %r10
leal (%r10,%r10), %eax
cltq
movq -0x10(%rdx,%rax,8), %r8
movq %rax, -0xb8(%rbp)
movq -0x8(%rdx,%rax,8), %r9
movq (%rbx,%r9,8), %rax
movslq 0x20(%r12), %r11
movq (%rbx,%r8,8), %rcx
movsd (%rcx,%r11,8), %xmm0
ucomisd (%rax,%r11,8), %xmm0
movq %r8, %rax
cmovaq %r9, %rax
movq %rax, -0xa8(%rbp)
movq %r9, %rax
cmovaq %r8, %rax
movq %rax, -0xb0(%rbp)
movq -0x80(%rbp), %rax
leal (%rax,%rax), %eax
movslq %eax, %rcx
movq -0x10(%rdx,%rcx,8), %rax
movq %rdx, -0x70(%rbp)
movq %rcx, -0x40(%rbp)
movq -0x8(%rdx,%rcx,8), %rdi
movq (%rbx,%rdi,8), %rcx
movq (%rbx,%rax,8), %rdx
movsd (%rdx,%r11,8), %xmm0
movq %r11, -0xc0(%rbp)
ucomisd (%rcx,%r11,8), %xmm0
movq %rdi, %rcx
cmovaq %rax, %rcx
movq %rcx, -0x58(%rbp)
cmovbeq %rax, %rdi
movq 0x50(%r12), %rcx
movslq %edi, %rax
movq %rax, -0x50(%rbp)
cmpl $0x3, (%rcx,%rax,4)
jne 0x8fab
movq %rdi, -0xa0(%rbp)
movl %r13d, -0x40(%rbp)
movq -0x48(%rbp), %rax
addl $-0x3, %eax
testl %eax, %eax
jle 0x9250
movslq -0x58(%rbp), %rcx
movl %esi, %r10d
movq -0x70(%rbp), %rax
leaq 0x8(%rax), %r12
xorl %edx, %edx
movl $0x1, %edi
xorl %r13d, %r13d
movq $0x0, -0x30(%rbp)
xorl %r15d, %r15d
movq -0x8(%r12), %r11
movq (%r12), %rax
cmpq -0x50(%rbp), %rax
jne 0x8f5a
cmpq %rcx, %r11
jne 0x8f26
movq %rcx, %r11
jmp 0x8f5a
testl %edx, %edx
movl %r15d, -0x48(%rbp)
movq %r10, %r15
movq %rcx, %r10
movq %r13, %rcx
movq -0x30(%rbp), %r13
cmovel %edi, %r13d
movq %r13, -0x30(%rbp)
movq %rcx, %r13
movq %r10, %rcx
movq %r15, %r10
movl -0x48(%rbp), %r15d
cmovnel %edi, %r13d
cmovnel %r11d, %r15d
cmovel %r11d, %edx
cmpq -0x50(%rbp), %r11
jne 0x8f7e
cmpq %rcx, %rax
je 0x8f7e
testl %edx, %edx
movq -0x30(%rbp), %r11
cmovel %edi, %r11d
movq %r11, -0x30(%rbp)
cmovnel %edi, %r13d
cmovnel %eax, %r15d
cmovel %eax, %edx
incq %rdi
addq $0x10, %r12
cmpq %rdi, %r10
jne 0x8f0d
movq %r13, -0x68(%rbp)
movslq %edx, %rax
movq %rax, -0x90(%rbp)
movslq %r15d, %rax
movq %rax, -0x98(%rbp)
movq -0x78(%rbp), %r12
jmp 0x9276
movl %r13d, %eax
movq 0x38(%r12), %r13
movslq %r10d, %r10
movsd -0x8(%r13,%r10,8), %xmm0
movsd 0xc093(%rip), %xmm1     # 0x15058
ucomisd %xmm0, %xmm1
movq %rcx, -0x68(%rbp)
jb 0x90e0
testl %esi, %esi
jle 0x90e0
movl %esi, %ecx
movq %rcx, -0x30(%rbp)
notl %eax
addl %eax, %r15d
movl $0x1, %edi
xorl %r11d, %r11d
movapd 0xc08a(%rip), %xmm0     # 0x15080
movsd 0xc012(%rip), %xmm2     # 0x15010
movq %r15, -0x38(%rbp)
cmpq -0x30(%rbp), %rdi
jae 0x90c2
movq (%r14,%rdi,8), %r15
movq (%r14,%r8,8), %rcx
movq (%r14,%r9,8), %rax
movq %r11, %r12
movsd 0x10(%r15,%r12,8), %xmm6
movsd (%r15,%r9,8), %xmm3
movapd %xmm6, %xmm5
subsd %xmm3, %xmm5
movsd -0x8(%r13,%r10,8), %xmm7
subsd %xmm7, %xmm5
movsd 0x10(%rcx,%r12,8), %xmm4
subsd %xmm4, %xmm5
andpd %xmm0, %xmm5
ucomisd %xmm5, %xmm2
movsd (%r15,%r8,8), %xmm5
jbe 0x905f
movsd 0x10(%rax,%r12,8), %xmm7
jmp 0x907c
subsd %xmm5, %xmm6
subsd %xmm7, %xmm6
movsd 0x10(%rax,%r12,8), %xmm7
subsd %xmm7, %xmm6
andpd %xmm0, %xmm6
ucomisd %xmm6, %xmm2
jbe 0x90b2
addsd %xmm4, %xmm3
addsd %xmm7, %xmm5
minsd %xmm5, %xmm3
movq 0x10(%r14,%r12,8), %rdx
addsd %xmm1, %xmm3
movsd %xmm3, (%rdx,%rdi,8)
movsd %xmm3, 0x10(%r15,%r12,8)
movq 0x10(%rbx,%r12,8), %rdx
movsd %xmm3, (%rdx,%rdi,8)
movq (%rbx,%rdi,8), %rdx
movsd %xmm3, 0x10(%rdx,%r12,8)
incq %r12
leal 0x1(%r12), %edx
cmpl %edx, %esi
jg 0x901b
incq %rdi
incq %r11
movq -0x38(%rbp), %r15
cmpq %r15, %rdi
jne 0x9002
movsd -0x8(%r13,%r10,8), %xmm0
movq -0x78(%rbp), %r12
movq -0x48(%rbp), %r11
leal -0x1(%r11), %eax
movq %rax, -0xa0(%rbp)
movslq %eax, %rsi
movq -0x70(%rbp), %rdi
movq -0x40(%rbp), %rax
movq %rsi, -0x8(%rdi,%rax,8)
movslq -0x58(%rbp), %rdx
movq %rdx, -0x10(%rdi,%rax,8)
movslq -0x80(%rbp), %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, -0x8(%r13,%rax,8)
movq -0xb8(%rbp), %r8
movq -0x8(%rdi,%r8,8), %rax
leal -0x5(%r11,%r11), %ecx
movslq %ecx, %rcx
movq %rax, (%rdi,%rcx,8)
mulsd 0xbecd(%rip), %xmm0     # 0x15008
maxsd 0xbefd(%rip), %xmm0     # 0x15040
leal -0x6(%r11,%r11), %eax
cltq
movq %rsi, (%rdi,%rax,8)
leal -0x3(%r11), %eax
cltq
movsd %xmm0, (%r13,%rax,8)
movq -0x10(%rdi,%r8,8), %rax
movq %rax, -0x8(%rdi,%r8,8)
movq %rsi, -0x10(%rdi,%r8,8)
movsd %xmm0, -0x8(%r13,%r10,8)
movq -0x68(%rbp), %rcx
movl $0x3, (%rcx,%rsi,4)
movq -0x50(%rbp), %rax
decl (%rcx,%rax,4)
movl 0x48(%r12), %eax
decl %eax
movl %eax, -0x40(%rbp)
movl %eax, 0x48(%r12)
testl %esi, %esi
jle 0x9515
movslq 0x20(%r12), %rax
movq (%r14,%rdx,8), %rcx
movslq -0xa8(%rbp), %rdi
shlq $0x3, %rdi
movslq -0xb0(%rbp), %r9
shlq $0x3, %r9
movl %r11d, %r10d
movq (%rbx,%rsi,8), %r8
movl $0x1, %r11d
movapd 0xbeb2(%rip), %xmm1     # 0x15080
movsd 0xbe8a(%rip), %xmm2     # 0x15060
movsd 0xbe8a(%rip), %xmm3     # 0x15068
movq (%r14,%r11,8), %r15
movsd (%r15,%rax,8), %xmm4
subsd (%r15,%rdx,8), %xmm4
subsd (%rcx,%rax,8), %xmm4
andpd %xmm1, %xmm4
ucomisd %xmm4, %xmm2
jbe 0x920d
movsd (%rcx,%r11,8), %xmm4
addsd %xmm3, %xmm4
movq (%rbx,%r11,8), %r15
jmp 0x922b
movsd (%r15,%rdi), %xmm4
addsd %xmm0, %xmm4
movsd (%r15,%r9), %xmm5
addsd %xmm0, %xmm5
ucomisd %xmm4, %xmm5
movq (%rbx,%r11,8), %r15
jbe 0x9233
movsd %xmm4, (%r15,%rsi,8)
jmp 0x923d
movsd %xmm5, (%r15,%rsi,8)
movapd %xmm5, %xmm4
movsd %xmm4, (%r8,%r11,8)
incq %r11
cmpq %r11, %r10
jne 0x91de
jmp 0x9519
movq $0x0, -0x30(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x98(%rbp)
movq $0x0, -0x90(%rbp)
movq -0x60(%rbp), %rax
movq 0x38(%r12), %r13
movslq %eax, %r12
movsd 0xbdce(%rip), %xmm0     # 0x15058
ucomisd -0x8(%r13,%r12,8), %xmm0
jb 0x9396
testl %esi, %esi
jle 0x9396
movl %esi, %eax
movq %rax, -0x48(%rbp)
movl -0x40(%rbp), %eax
notl %eax
addl -0x38(%rbp), %eax
movq %rax, -0x60(%rbp)
movl $0x1, %r10d
xorl %edx, %edx
movapd 0xbdbf(%rip), %xmm1     # 0x15080
movsd 0xbd47(%rip), %xmm2     # 0x15010
cmpq -0x48(%rbp), %r10
jae 0x9386
movq (%r14,%r10,8), %r11
movq (%r14,%r8,8), %r15
movq (%r14,%r9,8), %rax
movq %rdx, %rcx
movsd 0x10(%r11,%rcx,8), %xmm6
movsd (%r11,%r9,8), %xmm3
movapd %xmm6, %xmm5
subsd %xmm3, %xmm5
movsd -0x8(%r13,%r12,8), %xmm7
subsd %xmm7, %xmm5
movsd 0x10(%r15,%rcx,8), %xmm4
subsd %xmm4, %xmm5
andpd %xmm1, %xmm5
ucomisd %xmm5, %xmm2
movsd (%r11,%r8,8), %xmm5
jbe 0x9325
movsd 0x10(%rax,%rcx,8), %xmm7
jmp 0x9341
subsd %xmm5, %xmm6
subsd %xmm7, %xmm6
movsd 0x10(%rax,%rcx,8), %xmm7
subsd %xmm7, %xmm6
andpd %xmm1, %xmm6
ucomisd %xmm6, %xmm2
jbe 0x9378
addsd %xmm4, %xmm3
addsd %xmm7, %xmm5
minsd %xmm5, %xmm3
movq 0x10(%r14,%rcx,8), %rdi
addsd %xmm0, %xmm3
movsd %xmm3, (%rdi,%r10,8)
movsd %xmm3, 0x10(%r11,%rcx,8)
movq 0x10(%rbx,%rcx,8), %rdi
movsd %xmm3, (%rdi,%r10,8)
movq (%rbx,%r10,8), %rdi
movsd %xmm3, 0x10(%rdi,%rcx,8)
incq %rcx
leal 0x1(%rcx), %edi
cmpl %edi, %esi
jg 0x92e2
incq %r10
incq %rdx
cmpq -0x60(%rbp), %r10
jne 0x92c9
movq -0x30(%rbp), %rdx
leal (%rdx,%rdx), %eax
movq -0x68(%rbp), %r8
leal (%r8,%r8), %ecx
cltq
movq -0x70(%rbp), %rdi
movq -0x90(%rbp), %r9
movq %r9, -0x8(%rdi,%rax,8)
movq -0x98(%rbp), %r9
movq %r9, -0x10(%rdi,%rax,8)
movslq %edx, %rax
movsd -0x8(%r13,%rax,8), %xmm0
movslq %r8d, %rdx
addsd -0x8(%r13,%rdx,8), %xmm0
movsd %xmm0, -0x8(%r13,%rax,8)
movq -0xb8(%rbp), %r8
movq -0x8(%rdi,%r8,8), %rax
movslq %ecx, %rcx
movq %rax, -0x8(%rdi,%rcx,8)
movq -0x50(%rbp), %r15
movq %r15, -0x10(%rdi,%rcx,8)
movsd 0xbc05(%rip), %xmm0     # 0x15008
movsd -0x8(%r13,%r12,8), %xmm1
mulsd %xmm0, %xmm1
movsd 0xbc2a(%rip), %xmm2     # 0x15040
maxsd %xmm2, %xmm1
movsd %xmm1, -0x8(%r13,%rdx,8)
movq -0x10(%rdi,%r8,8), %rax
movq %rax, -0x8(%rdi,%r8,8)
movq %r15, -0x10(%rdi,%r8,8)
mulsd -0x8(%r13,%r12,8), %xmm0
maxsd %xmm2, %xmm0
movsd %xmm0, -0x8(%r13,%r12,8)
testl %esi, %esi
jle 0x9532
movslq -0x58(%rbp), %rcx
movq (%r14,%rcx,8), %rdx
movslq -0xa8(%rbp), %rsi
shlq $0x3, %rsi
movslq -0xb0(%rbp), %rax
shlq $0x3, %rax
movl -0x40(%rbp), %edi
movl %edi, %r8d
notl %r8d
addl -0x38(%rbp), %r8d
movq (%rbx,%r15,8), %rdi
movl $0x1, %r9d
movapd 0xbbf9(%rip), %xmm0     # 0x15080
movsd 0xbbd1(%rip), %xmm1     # 0x15060
movsd 0xbbd1(%rip), %xmm2     # 0x15068
movq -0xc0(%rbp), %r11
movq (%r14,%r9,8), %r10
movsd (%r10,%r11,8), %xmm3
subsd (%r10,%rcx,8), %xmm3
subsd (%rdx,%r11,8), %xmm3
andpd %xmm0, %xmm3
ucomisd %xmm3, %xmm1
jbe 0x94ce
movsd (%rdx,%r9,8), %xmm3
addsd %xmm2, %xmm3
movq (%rbx,%r9,8), %r10
jmp 0x94ef
movsd (%r10,%rsi), %xmm3
movsd (%r10,%rax), %xmm4
ucomisd %xmm3, %xmm4
movsd -0x8(%r13,%r12,8), %xmm5
movq (%rbx,%r9,8), %r10
jbe 0x94f7
addsd %xmm5, %xmm3
movsd %xmm3, (%r10,%r15,8)
jmp 0x9505
addsd %xmm5, %xmm4
movsd %xmm4, (%r10,%r15,8)
movapd %xmm4, %xmm3
movsd %xmm3, (%rdi,%r9,8)
incq %r9
cmpq %r9, %r8
jne 0x949e
jmp 0x9536
movq (%rbx,%rsi,8), %r8
movq $0x0, (%r8,%rsi,8)
movl (%r12), %eax
movq %rax, -0x88(%rbp)
leal (%rax,%rax), %r12d
jmp 0x9555
movq (%rbx,%r15,8), %rdi
movq -0x38(%rbp), %r12
movq $0x0, (%rdi,%r15,8)
movslq -0x80(%rbp), %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, -0x8(%r13,%rax,8)
movl %r12d, %eax
orl $0x1, %eax
movslq %eax, %r15
shlq $0x2, %r15
movq %r15, %rdi
callq 0x1140
movq %rax, -0x30(%rbp)
movq %r15, %rdi
movq %r12, %r15
callq 0x1140
subl -0x40(%rbp), %r15d
addl $-0x2, %r15d
cmpl $0x2, %r15d
jl 0x9679
movslq -0x88(%rbp), %rdx
movslq -0x58(%rbp), %rsi
movq (%r14,%rsi,8), %rcx
movsd (%rcx,%rdx,8), %xmm0
movl %r15d, %r8d
xorl %ecx, %ecx
movl $0x1, %r9d
movapd 0xbace(%rip), %xmm1     # 0x15080
movsd 0xba86(%rip), %xmm2     # 0x15040
xorl %edi, %edi
movq -0x30(%rbp), %r15
movq (%r14,%r9,8), %r10
movsd (%r10,%rdx,8), %xmm3
subsd (%r10,%rsi,8), %xmm3
subsd %xmm0, %xmm3
andpd %xmm1, %xmm3
ucomisd %xmm3, %xmm2
jbe 0x95e8
movl %edi, %r10d
incl %edi
movq %r15, %r11
jmp 0x95f0
movl %ecx, %r10d
incl %ecx
movq %rax, %r11
movslq %r10d, %r10
movl %r9d, (%r11,%r10,4)
incq %r9
cmpq %r9, %r8
jne 0x95c0
testl %edi, %edi
jle 0x9679
movslq -0xa0(%rbp), %rdx
movslq -0x58(%rbp), %rsi
shlq $0x3, %rsi
movq %rsi, -0x38(%rbp)
movl %edi, %esi
movq %rsi, -0x50(%rbp)
movl %ecx, %r8d
xorl %r9d, %r9d
movsd 0xba3e(%rip), %xmm0     # 0x15068
testl %ecx, %ecx
jle 0x9670
movq -0x38(%rbp), %rsi
movq (%rbx,%rsi), %r10
movq -0x30(%rbp), %rsi
movslq (%rsi,%r9,4), %r11
movq (%rbx,%r11,8), %r15
xorl %r12d, %r12d
movslq (%rax,%r12,4), %rsi
movq (%rbx,%rsi,8), %rdi
movsd (%rdi,%rdx,8), %xmm1
addsd %xmm0, %xmm1
addsd (%r10,%r11,8), %xmm1
movsd %xmm1, (%rdi,%r11,8)
movsd %xmm1, (%r15,%rsi,8)
incq %r12
cmpq %r12, %r8
jne 0x9645
incq %r9
cmpq -0x50(%rbp), %r9
jne 0x962a
movq -0x78(%rbp), %r15
movq 0x28(%r15), %rdi
movq -0x70(%rbp), %rsi
movq %r13, %rdx
movq -0x88(%rbp), %rcx
movl -0x40(%rbp), %r8d
callq 0x2215
cmpl $0x0, (%r15)
jle 0x96b7
xorl %ebx, %ebx
movq (%r14,%rbx,8), %rdi
callq 0x1100
incq %rbx
movslq (%r15), %rax
addq %rax, %rax
cmpq %rax, %rbx
jl 0x96a0
movq %r14, %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1100
leaq 0xc25f(%rip), %rdi      # 0x15936
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1110