// File: dcarrey[P]hgt-detection/./fonctions.cpp
// Function: addLeafAndUpdate(InputTree*, int)
void addLeafAndUpdate(struct InputTree *aTree, int choix){
	
	int n = aTree->size;
	int i,j;


	for(i=1;i<=2*n-3-aTree->kt;i++){
		if(aTree->ARETE[2*i-1] > n) aTree->ARETE[2*i-1] += 1 ;
		if(aTree->ARETE[2*i-2] > n) aTree->ARETE[2*i-2] += 1 ;
	}
	

	//= ajout des 2 nouvelles branches
	aTree->ARETE[2*(2*n-2-aTree->kt)-1] = aTree->ARETE[2*choix-1];
	aTree->ARETE[2*(2*n-2-aTree->kt)-2] = 2*n-aTree->kt;
	aTree->LONGUEUR[(2*n-2-aTree->kt)-1] = ((aTree->LONGUEUR[choix-1]/2.0)>5*epsilon)?(aTree->LONGUEUR[choix-1]/2.0):5*epsilon;

	aTree->ARETE[2*(2*n-1-aTree->kt)-1] = aTree->ARETE[2*choix-2];
	aTree->ARETE[2*(2*n-1-aTree->kt)-2] = 2*n-aTree->kt;
	aTree->LONGUEUR[(2*n-1-aTree->kt)-1] = ((aTree->LONGUEUR[choix-1]/2.0)>5*epsilon)?(aTree->LONGUEUR[choix-1]/2.0):5*epsilon;
	
	aTree->ARETE[2*choix-1] = n+1;
	aTree->ARETE[2*choix-2] = 2*n-aTree->kt;
	aTree->LONGUEUR[choix-1]= 5*epsilon;  

	aTree->size = aTree->size+1;


	loadAdjacenceMatrix(aTree->Adjacence,aTree->ARETE, aTree->LONGUEUR,n+1,aTree->kt);

	Floyd(aTree->Adjacence,aTree->ADD,aTree->Input,n+1,aTree->kt);//5eme fois

	strcpy(aTree->SpeciesName[aTree->size],"Root");

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl -0x10(%rbp), %ecx
shll %ecx
subl $0x3, %ecx
movq -0x8(%rbp), %rdx
subl 0x48(%rdx), %ecx
cmpl %ecx, %eax
jg 0xbd17
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x14(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
cmpq %rcx, %rax
jle 0xbcc8
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x14(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x14(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
cmpq %rcx, %rax
jle 0xbd07
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x14(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0xbd09
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xbc6f
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0xc(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x10(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movq -0x8(%rbp), %rsi
subl 0x48(%rsi), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x10(%rbp), %eax
shll %eax
movq -0x8(%rbp), %rcx
subl 0x48(%rcx), %eax
movslq %eax, %rdx
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x10(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movq -0x8(%rbp), %rsi
subl 0x48(%rsi), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x19267(%rip), %xmm1    # 0x25008
divsd %xmm1, %xmm0
movsd 0x19293(%rip), %xmm1    # 0x25040
ucomisd %xmm1, %xmm0
jbe 0xbddc
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x19237(%rip), %xmm1    # 0x25008
divsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
jmp 0xbdeb
movsd 0x1925c(%rip), %xmm0    # 0x25040
movsd %xmm0, -0x20(%rbp)
jmp 0xbdeb
movsd -0x20(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl -0x10(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movq -0x8(%rbp), %rdx
subl 0x48(%rdx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0xc(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x10(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movq -0x8(%rbp), %rsi
subl 0x48(%rsi), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x10(%rbp), %eax
shll %eax
movq -0x8(%rbp), %rcx
subl 0x48(%rcx), %eax
movslq %eax, %rdx
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x10(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movq -0x8(%rbp), %rsi
subl 0x48(%rsi), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x1916c(%rip), %xmm1    # 0x25008
divsd %xmm1, %xmm0
movsd 0x19198(%rip), %xmm1    # 0x25040
ucomisd %xmm1, %xmm0
jbe 0xbed7
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x1913c(%rip), %xmm1    # 0x25008
divsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0xbee6
movsd 0x19161(%rip), %xmm0    # 0x25040
movsd %xmm0, -0x28(%rbp)
jmp 0xbee6
movsd -0x28(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl -0x10(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movq -0x8(%rbp), %rdx
subl 0x48(%rdx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0xc(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x10(%rbp), %eax
shll %eax
movq -0x8(%rbp), %rcx
subl 0x48(%rcx), %eax
movslq %eax, %rdx
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0xc(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd 0x190d4(%rip), %xmm0    # 0x25040
movsd %xmm0, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdx
movl -0x10(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl 0x48(%rax), %r8d
callq 0x3230
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdx
movl -0x10(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl 0x48(%rax), %r8d
callq 0x2a10
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x8(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1973b(%rip), %rsi     # 0x2572b
callq 0x1080
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)