// File: /workspace/github_cpp_makefile_star2_O1/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, -0x78(%rbp)
testl %edx, %edx
je 0x97d7
testl %ecx, %ecx
je 0x97d7
movq %rsi, %r13
movq %rcx, -0x70(%rbp)
movl 0x48(%rsi), %eax
movl %eax, -0x3c(%rbp)
movslq (%rsi), %rbx
leal (%rbx,%rbx), %eax
movq %rax, -0x48(%rbp)
movq %rbx, %r15
shlq $0x4, %r15
movq %r15, %rdi
callq 0x1140
movq %rax, %r14
testq %rbx, %rbx
jle 0x8f06
movq -0x48(%rbp), %rax
cmpl $0x2, %eax
movl $0x1, %ebx
cmovgel %eax, %ebx
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x1140
movq %rax, (%r14,%r12,8)
incq %r12
cmpq %r12, %rbx
jne 0x8ef2
movq -0x48(%rbp), %rcx
movl %ecx, %eax
subl -0x3c(%rbp), %eax
movq %rax, -0x30(%rbp)
leal -0x2(%rax), %esi
testl %esi, %esi
movq -0x78(%rbp), %r10
jle 0x8f58
movl -0x3c(%rbp), %eax
notl %eax
addl %ecx, %eax
movq 0x8(%r13), %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 0x8f3c
incq %rdx
cmpq %rax, %rdx
jne 0x8f2e
movq 0x8(%r13), %rbx
movq 0x30(%r13), %rdx
leal (%r10,%r10), %eax
movslq %eax, %r12
movq -0x10(%rdx,%r12,8), %r9
movq -0x8(%rdx,%r12,8), %r10
movq (%rbx,%r10,8), %rax
movslq 0x20(%r13), %r15
movq (%rbx,%r9,8), %rcx
movsd (%rcx,%r15,8), %xmm0
ucomisd (%rax,%r15,8), %xmm0
movq %r9, %r11
cmovaq %r10, %r11
movq %r10, %r8
cmovaq %r9, %r8
movq -0x70(%rbp), %rax
leal (%rax,%rax), %eax
movslq %eax, %rcx
movq -0x10(%rdx,%rcx,8), %rax
movq %rdx, -0x68(%rbp)
movq %rcx, -0x38(%rbp)
movq -0x8(%rdx,%rcx,8), %rdi
movq (%rbx,%rdi,8), %rcx
movq (%rbx,%rax,8), %rdx
movsd (%rdx,%r15,8), %xmm0
movq %r15, -0xb8(%rbp)
ucomisd (%rcx,%r15,8), %xmm0
movq %rdi, %rcx
cmovaq %rax, %rcx
movq %rcx, -0x58(%rbp)
cmovbeq %rax, %rdi
movq 0x50(%r13), %rax
movq %rdi, -0xb0(%rbp)
movslq %edi, %r15
cmpl $0x3, (%rax,%r15,4)
movq %r13, -0x60(%rbp)
movq %r15, -0x80(%rbp)
movq %r8, -0xa0(%rbp)
movq %r11, -0x98(%rbp)
movq %r12, -0xa8(%rbp)
jne 0x90e6
movq -0x30(%rbp), %rax
addl $-0x3, %eax
testl %eax, %eax
jle 0x9383
movslq -0x58(%rbp), %rcx
movl %esi, %eax
movq %rax, -0x50(%rbp)
xorl %r13d, %r13d
movl $0x1, %edi
movq -0x68(%rbp), %r12
movl $0x0, -0x38(%rbp)
movl $0x0, -0x30(%rbp)
xorl %edx, %edx
movq 0x8(%r12), %rax
cmpq %r15, %rax
jne 0x908a
movq (%r12), %r11
cmpq %rcx, %r11
je 0x908a
testl %r13d, %r13d
cmovel %edi, %edx
movq %rcx, %r8
movq %rdx, %rcx
movl -0x30(%rbp), %edx
cmovnel %edi, %edx
movl %edx, -0x30(%rbp)
movq %rcx, %rdx
movq %r8, %rcx
movq -0x80(%rbp), %r15
movl -0x38(%rbp), %r8d
cmovnel %r11d, %r8d
movl %r8d, -0x38(%rbp)
cmovel %r11d, %r13d
cmpq %r15, (%r12)
jne 0x90b7
cmpq %rcx, %rax
je 0x90b7
testl %r13d, %r13d
cmovel %edi, %edx
movl -0x30(%rbp), %r11d
cmovnel %edi, %r11d
movl %r11d, -0x30(%rbp)
movl -0x38(%rbp), %r11d
cmovnel %eax, %r11d
movl %r11d, -0x38(%rbp)
cmovel %eax, %r13d
incq %rdi
addq $0x10, %r12
cmpq %rdi, -0x50(%rbp)
jne 0x9048
movq %rdx, -0x50(%rbp)
movslq %r13d, %rax
movq %rax, -0x88(%rbp)
movslq -0x38(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x60(%rbp), %r13
jmp 0x93a8
movq %rax, -0x50(%rbp)
movq 0x38(%r13), %r8
movslq -0x78(%rbp), %r15
movsd 0xbf5e(%rip), %xmm0     # 0x15058
ucomisd -0x8(%r8,%r15,8), %xmm0
jb 0x9203
testl %esi, %esi
jle 0x9203
movl %esi, %edi
movl -0x3c(%rbp), %ecx
notl %ecx
movq -0x48(%rbp), %rax
addl %ecx, %eax
movq %rax, -0x48(%rbp)
movl $0x1, %r12d
xorl %r13d, %r13d
movapd 0xbf4f(%rip), %xmm1     # 0x15080
movsd 0xbed7(%rip), %xmm2     # 0x15010
cmpq %rdi, %r12
jae 0x91f3
movq (%r14,%r12,8), %rcx
movq (%r14,%r9,8), %rdx
movq %r13, %rax
movsd 0x10(%rcx,%rax,8), %xmm4
movsd (%rcx,%r10,8), %xmm3
movapd %xmm4, %xmm7
subsd %xmm3, %xmm7
movsd -0x8(%r8,%r15,8), %xmm6
subsd %xmm6, %xmm7
movsd 0x10(%rdx,%rax,8), %xmm5
subsd %xmm5, %xmm7
andpd %xmm1, %xmm7
ucomisd %xmm7, %xmm2
ja 0x919f
subsd (%rcx,%r9,8), %xmm4
subsd %xmm6, %xmm4
movq (%r14,%r10,8), %r11
subsd 0x10(%r11,%rax,8), %xmm4
andpd %xmm1, %xmm4
ucomisd %xmm4, %xmm2
jbe 0x91e3
addsd %xmm5, %xmm3
movsd (%rcx,%r9,8), %xmm4
movq (%r14,%r10,8), %r11
addsd 0x10(%r11,%rax,8), %xmm4
minsd %xmm4, %xmm3
movq 0x10(%r14,%rax,8), %r11
addsd %xmm0, %xmm3
movsd %xmm3, (%r11,%r12,8)
movsd %xmm3, 0x10(%rcx,%rax,8)
movq 0x10(%rbx,%rax,8), %r11
movsd %xmm3, (%r11,%r12,8)
movq (%rbx,%r12,8), %r11
movsd %xmm3, 0x10(%r11,%rax,8)
incq %rax
leal 0x1(%rax), %r11d
cmpl %r11d, %esi
jg 0x914d
incq %r12
incq %r13
cmpq -0x48(%rbp), %r12
jne 0x9139
movq -0x30(%rbp), %r10
leal -0x1(%r10), %eax
movsd -0x8(%r8,%r15,8), %xmm0
movq %rax, -0xb0(%rbp)
movslq %eax, %rsi
movq -0x68(%rbp), %rdx
movq -0x38(%rbp), %rax
movq %rsi, -0x8(%rdx,%rax,8)
movslq -0x58(%rbp), %rdi
movq %rdi, -0x10(%rdx,%rax,8)
movslq -0x70(%rbp), %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, -0x8(%r8,%rax,8)
movq -0xa8(%rbp), %r9
movq -0x8(%rdx,%r9,8), %rax
leal -0x5(%r10,%r10), %ecx
movslq %ecx, %rcx
movq %rax, (%rdx,%rcx,8)
mulsd 0xbda3(%rip), %xmm0     # 0x15008
maxsd 0xbdd3(%rip), %xmm0     # 0x15040
leal -0x6(%r10,%r10), %eax
cltq
movq %rsi, (%rdx,%rax,8)
leal -0x3(%r10), %eax
cltq
movsd %xmm0, (%r8,%rax,8)
movq -0x10(%rdx,%r9,8), %rax
movq %rax, -0x8(%rdx,%r9,8)
movq %rsi, -0x10(%rdx,%r9,8)
movsd %xmm0, -0x8(%r8,%r15,8)
movq -0x50(%rbp), %rcx
movl $0x3, (%rcx,%rsi,4)
movq -0x80(%rbp), %rax
decl (%rcx,%rax,4)
movq -0x60(%rbp), %r12
decl 0x48(%r12)
testl %esi, %esi
jle 0x9372
movslq 0x20(%r12), %rax
movq (%r14,%rdi,8), %rcx
movslq -0x98(%rbp), %rdx
shlq $0x3, %rdx
movslq -0xa0(%rbp), %r8
shlq $0x3, %r8
movq (%rbx,%rsi,8), %r9
movl $0x1, %r10d
movapd 0xbd92(%rip), %xmm1     # 0x15080
movsd 0xbd6a(%rip), %xmm2     # 0x15060
movsd 0xbd6a(%rip), %xmm3     # 0x15068
movq (%r14,%r10,8), %r15
movsd (%r15,%rax,8), %xmm4
subsd (%r15,%rdi,8), %xmm4
subsd (%rcx,%rax,8), %xmm4
andpd %xmm1, %xmm4
ucomisd %xmm4, %xmm2
jbe 0x9333
movsd (%rcx,%r10,8), %xmm4
addsd %xmm3, %xmm4
movq (%rbx,%r10,8), %r11
movsd %xmm4, (%r11,%rsi,8)
jmp 0x9363
movsd (%r15,%rdx), %xmm4
addsd %xmm0, %xmm4
movsd (%r15,%r8), %xmm5
addsd %xmm0, %xmm5
ucomisd %xmm4, %xmm5
movq (%rbx,%r10,8), %r15
jbe 0x9359
movsd %xmm4, (%r15,%rsi,8)
jmp 0x9363
movsd %xmm5, (%r15,%rsi,8)
movapd %xmm5, %xmm4
movsd %xmm4, (%r9,%r10,8)
incq %r10
cmpq %r10, -0x30(%rbp)
jne 0x92fe
movq (%rbx,%rsi,8), %rax
movq $0x0, (%rax,%rsi,8)
jmp 0x9657
movq $0x0, -0x50(%rbp)
movl $0x0, -0x30(%rbp)
movq $0x0, -0x90(%rbp)
movq $0x0, -0x88(%rbp)
movq 0x38(%r13), %rcx
movslq -0x78(%rbp), %r13
movsd 0xbca0(%rip), %xmm0     # 0x15058
ucomisd -0x8(%rcx,%r13,8), %xmm0
jb 0x94c0
testl %esi, %esi
jle 0x94c0
movl %esi, %eax
movq %rax, -0x38(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, %r8d
notl %r8d
addl -0x48(%rbp), %r8d
movl $0x1, %r12d
xorl %eax, %eax
movapd 0xbc90(%rip), %xmm1     # 0x15080
movsd 0xbc18(%rip), %xmm2     # 0x15010
cmpq -0x38(%rbp), %r12
jae 0x94b1
movq (%r14,%r12,8), %r11
movq (%r14,%r9,8), %r15
movq %rax, %rdx
movsd 0x10(%r11,%rdx,8), %xmm4
movsd (%r11,%r10,8), %xmm3
movapd %xmm4, %xmm7
subsd %xmm3, %xmm7
movsd -0x8(%rcx,%r13,8), %xmm6
subsd %xmm6, %xmm7
movsd 0x10(%r15,%rdx,8), %xmm5
subsd %xmm5, %xmm7
andpd %xmm1, %xmm7
ucomisd %xmm7, %xmm2
ja 0x9460
subsd (%r11,%r9,8), %xmm4
subsd %xmm6, %xmm4
movq (%r14,%r10,8), %rdi
subsd 0x10(%rdi,%rdx,8), %xmm4
andpd %xmm1, %xmm4
ucomisd %xmm4, %xmm2
jbe 0x94a3
addsd %xmm5, %xmm3
movsd (%r11,%r9,8), %xmm4
movq (%r14,%r10,8), %rdi
addsd 0x10(%rdi,%rdx,8), %xmm4
minsd %xmm4, %xmm3
movq 0x10(%r14,%rdx,8), %rdi
addsd %xmm0, %xmm3
movsd %xmm3, (%rdi,%r12,8)
movsd %xmm3, 0x10(%r11,%rdx,8)
movq 0x10(%rbx,%rdx,8), %rdi
movsd %xmm3, (%rdi,%r12,8)
movq (%rbx,%r12,8), %rdi
movsd %xmm3, 0x10(%rdi,%rdx,8)
incq %rdx
leal 0x1(%rdx), %edi
cmpl %edi, %esi
jg 0x940d
incq %r12
incq %rax
cmpq %r8, %r12
jne 0x93f8
movq -0x50(%rbp), %rdx
leal (%rdx,%rdx), %eax
cltq
movq -0x68(%rbp), %r8
movq -0x88(%rbp), %rdi
movq %rdi, -0x8(%r8,%rax,8)
movq -0x90(%rbp), %rdi
movq %rdi, -0x10(%r8,%rax,8)
movslq %edx, %rax
movsd -0x8(%rcx,%rax,8), %xmm0
movslq -0x30(%rbp), %rdx
addsd -0x8(%rcx,%rdx,8), %xmm0
movsd %xmm0, -0x8(%rcx,%rax,8)
movq -0xa8(%rbp), %r9
movq -0x8(%r8,%r9,8), %rax
leal (%rdx,%rdx), %edi
movslq %edi, %rdi
movq %rax, -0x8(%r8,%rdi,8)
movq -0x80(%rbp), %r15
movq %r15, -0x10(%r8,%rdi,8)
movsd 0xbae2(%rip), %xmm0     # 0x15008
movsd -0x8(%rcx,%r13,8), %xmm1
mulsd %xmm0, %xmm1
movsd 0xbb07(%rip), %xmm2     # 0x15040
maxsd %xmm2, %xmm1
movsd %xmm1, -0x8(%rcx,%rdx,8)
movq -0x10(%r8,%r9,8), %rax
movq %rax, -0x8(%r8,%r9,8)
movq %r15, -0x10(%r8,%r9,8)
mulsd -0x8(%rcx,%r13,8), %xmm0
maxsd %xmm2, %xmm0
movsd %xmm0, -0x8(%rcx,%r13,8)
testl %esi, %esi
movq -0x48(%rbp), %r11
movq -0xb8(%rbp), %r12
jle 0x9634
movslq -0x58(%rbp), %rdx
movq (%r14,%rdx,8), %rsi
movslq -0x98(%rbp), %rdi
shlq $0x3, %rdi
movslq -0xa0(%rbp), %r8
shlq $0x3, %r8
movl -0x3c(%rbp), %eax
notl %eax
addl %eax, %r11d
movq (%rbx,%r15,8), %rax
movl $0x1, %r9d
movapd 0xbad1(%rip), %xmm0     # 0x15080
movsd 0xbaa9(%rip), %xmm1     # 0x15060
movsd 0xbaa9(%rip), %xmm2     # 0x15068
movq (%r14,%r9,8), %r10
movsd (%r10,%r12,8), %xmm3
subsd (%r10,%rdx,8), %xmm3
subsd (%rsi,%r12,8), %xmm3
andpd %xmm0, %xmm3
ucomisd %xmm3, %xmm1
jbe 0x95ef
movsd (%rsi,%r9,8), %xmm3
addsd %xmm2, %xmm3
movq (%rbx,%r9,8), %r10
jmp 0x9610
movsd (%r10,%rdi), %xmm3
movsd (%r10,%r8), %xmm4
ucomisd %xmm3, %xmm4
movsd -0x8(%rcx,%r13,8), %xmm5
movq (%rbx,%r9,8), %r10
jbe 0x9618
addsd %xmm5, %xmm3
movsd %xmm3, (%r10,%r15,8)
jmp 0x9626
addsd %xmm5, %xmm4
movsd %xmm4, (%r10,%r15,8)
movapd %xmm4, %xmm3
movsd %xmm3, (%rax,%r9,8)
incq %r9
cmpq %r9, %r11
jne 0x95bf
movq (%rbx,%r15,8), %rax
movq $0x0, (%rax,%r15,8)
movslq -0x70(%rbp), %rax
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movq %rdx, -0x8(%rcx,%rax,8)
movq -0x60(%rbp), %r12
movslq (%r12), %r13
leal (,%r13,2), %r15d
leaq 0x4(,%r13,8), %r12
movq %r12, %rdi
callq 0x1140
movq %rax, -0x30(%rbp)
movq %r12, %rdi
callq 0x1140
movq -0x60(%rbp), %rcx
movl 0x48(%rcx), %ecx
movl %ecx, -0x50(%rbp)
subl %ecx, %r15d
addl $-0x2, %r15d
xorl %edx, %edx
movl $0x0, %ecx
cmpl $0x2, %r15d
jl 0x9708
movslq -0x58(%rbp), %rsi
movq (%r14,%rsi,8), %rcx
movsd (%rcx,%r13,8), %xmm0
movl %r15d, %edi
xorl %ecx, %ecx
movl $0x1, %r9d
movapd 0xb9c2(%rip), %xmm1     # 0x15080
movsd 0xb97a(%rip), %xmm2     # 0x15040
xorl %edx, %edx
movq (%r14,%r9,8), %r10
movsd (%r10,%r13,8), %xmm3
subsd (%r10,%rsi,8), %xmm3
subsd %xmm0, %xmm3
andpd %xmm1, %xmm3
ucomisd %xmm3, %xmm2
jbe 0x96f1
movl %edx, %r10d
incl %edx
movq -0x30(%rbp), %r11
jmp 0x96f9
movl %ecx, %r10d
incl %ecx
movq %rax, %r11
movslq %r10d, %r10
movl %r9d, (%r11,%r10,4)
incq %r9
cmpq %r9, %rdi
jne 0x96c8
movq %r13, -0x48(%rbp)
testl %edx, %edx
jle 0x9782
movslq -0xb0(%rbp), %rsi
movslq -0x58(%rbp), %rdi
shlq $0x3, %rdi
movq %rdi, -0x38(%rbp)
movl %edx, %edx
movl %ecx, %r9d
xorl %r10d, %r10d
movsd 0xb935(%rip), %xmm0     # 0x15068
testl %ecx, %ecx
jle 0x977a
movq -0x38(%rbp), %rdi
movq (%rbx,%rdi), %r11
movq -0x30(%rbp), %rdi
movslq (%rdi,%r10,4), %r15
movq (%rbx,%r15,8), %r12
xorl %r13d, %r13d
movslq (%rax,%r13,4), %rdi
movq (%rbx,%rdi,8), %r8
movsd (%r8,%rsi,8), %xmm1
addsd %xmm0, %xmm1
addsd (%r11,%r15,8), %xmm1
movsd %xmm1, (%r8,%r15,8)
movsd %xmm1, (%r12,%rdi,8)
incq %r13
cmpq %r13, %r9
jne 0x974e
incq %r10
cmpq %rdx, %r10
jne 0x9733
movq -0x60(%rbp), %r15
movq 0x28(%r15), %rdi
movq 0x38(%r15), %rdx
movq -0x68(%rbp), %rsi
movq -0x48(%rbp), %rcx
movl -0x50(%rbp), %r8d
callq 0x22a4
cmpl $0x0, (%r15)
jle 0x97be
xorl %ebx, %ebx
movq (%r14,%rbx,8), %rdi
callq 0x1100
incq %rbx
movslq (%r15), %rax
addq %rax, %rax
cmpq %rax, %rbx
jl 0x97a7
movq %r14, %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1100
leaq 0xc158(%rip), %rdi      # 0x15936
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1110