// File: dcarrey[P]hgt-detection/./fonctions.cpp
// Function: CreateSubStructures(InputTree*, int, int)
void CreateSubStructures(struct InputTree * aTree,int inc,int binaire){
	
	int n = aTree->size;
	int i,j;
	int kt=0;
	inc = 10;
	
	
	//printf("n=%d",n);
	if(aTree->ARETE == NULL){
		aTree->ARETE    =(long int*)malloc(4*(2*(n+inc))*sizeof(long int));
		aTree->LONGUEUR	=(double*)malloc((4*(n+inc))*sizeof(double));
		aTree->Adjacence=(double**)malloc((2*(n+inc)+1)*sizeof(double*));
		for(i=0;i<2*(n+inc);i++)
			aTree->Adjacence[i]=(double*)malloc((2*(n+inc)+1)*sizeof(double));
	}
//	printf("\nbinaire = %d",binaire);
	kt = aTree->kt = Tree_edges (aTree->ADD,aTree->ARETE,aTree->LONGUEUR,n,binaire);
	
	//printf("\n\n");
	//printEdges(0,aTree->ARETE,aTree->LONGUEUR,aTree->SpeciesName,aTree->size);
	//for(i=1;i<=2*n-3-kt;i++)
	//	printf("\n%d-%d : %lf",aTree->ARETE[2*i-1],aTree->ARETE[2*i-2],aTree->LONGUEUR[i-1]);
	//scanf("%d",&i);
	loadAdjacenceMatrix(aTree->Adjacence,aTree->ARETE, aTree->LONGUEUR,n,aTree->kt);
	Floyd(aTree->Adjacence,aTree->ADD,n,aTree->kt); // 4eme fois
//  global_cpt4++;
	
  //===creation de degre
	aTree->degre = (int*)malloc(2*(n+inc)*sizeof(int));
	for(i=1;i<=2*n-2-kt;i++){
		aTree->degre[i]=0;
		for(j=1;j<=2*n-2-kt;j++)
			if(aTree->Adjacence[i][j] < INFINI) aTree->degre[i]++;
	}
	/*for(i=1;i<=2*n-2-kt;i++)
		printf("%d ",aTree->degre[i]);*/
	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
movl $0x0, -0x20(%rbp)
movl $0xa, -0xc(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x180e9
movl -0x14(%rbp), %eax
addl -0xc(%rbp), %eax
shll %eax
shll $0x2, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x1110
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x30(%rax)
movl -0x14(%rbp), %eax
addl -0xc(%rbp), %eax
shll $0x2, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x1110
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x38(%rax)
movl -0x14(%rbp), %eax
addl -0xc(%rbp), %eax
shll %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x1110
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
addl -0xc(%rbp), %ecx
shll %ecx
cmpl %ecx, %eax
jge 0x180e7
movl -0x14(%rbp), %eax
addl -0xc(%rbp), %eax
shll %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x1110
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x18(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x180a3
jmp 0x180e9
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdx
movl -0x14(%rbp), %ecx
movl -0x10(%rbp), %r8d
callq 0x3570
movq -0x8(%rbp), %rcx
movl %eax, 0x48(%rcx)
movl %eax, -0x20(%rbp)
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 -0x14(%rbp), %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
movl -0x14(%rbp), %edx
movq -0x8(%rbp), %rax
movl 0x48(%rax), %ecx
callq 0x2850
movl -0x14(%rbp), %eax
addl -0xc(%rbp), %eax
shll %eax
movslq %eax, %rdi
shlq $0x2, %rdi
callq 0x1110
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x50(%rax)
movl $0x1, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
subl -0x20(%rbp), %ecx
cmpl %ecx, %eax
jg 0x1821b
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x18(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl -0x14(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
subl -0x20(%rbp), %ecx
cmpl %ecx, %eax
jg 0x1820b
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movsd 0xce46(%rip), %xmm0     # 0x25028
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x181fe
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x18200
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x181b4
jmp 0x1820d
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x18184
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)