// File: dcarrey[P]hgt-detection/./fonctions.cpp
// Function: chargerFichier(InputTree*, char const*, char const*)
void chargerFichier(struct InputTree *aTree,const char* branchesFile,const char* rootFile){
	
	FILE *branch = fopen(branchesFile,"r");
	FILE *root =  fopen(rootFile,"r");
	int aa,bb,i,noBranch=0;
	double ll;

	for(i=1;i<=2*(aTree->size)-3;i++){
		fscanf(branch,"%d %d %lf",&aa,&bb,&ll);
		aTree->ARETE[2*i-1] = aa;
		aTree->ARETE[2*i-2] = bb;
		aTree->LONGUEUR[i-1] = ll;
		//printf("\n%d %d %lf",ARETE[2*i-1],ARETE[2*i-2],LONGUEUR[i-1]);
	}
	fscanf(root,"%d %d",&aa,&bb);

	for(i=1;i<=2*(aTree->size)-3;i++)
		if((aTree->ARETE[2*i-1] == aa && aTree->ARETE[2*i-2] == bb) || (aTree->ARETE[2*i-1] == bb && aTree->ARETE[2*i-2] == aa))
			noBranch = i;
	printf("-->nobranch=%d<--",i);
	addLeafAndUpdate(aTree,noBranch);
	aTree->Root = aTree->size;

	fclose(branch);
	fclose(root);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xac58(%rip), %rsi      # 0x26417
callq 0x10c0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
leaq 0xac44(%rip), %rsi      # 0x26417
callq 0x10c0
movq %rax, -0x28(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
movl (%rcx), %ecx
shll %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jg 0x1b879
movq -0x20(%rbp), %rdi
leaq 0xac8a(%rip), %rsi      # 0x26491
leaq -0x2c(%rbp), %rdx
leaq -0x30(%rbp), %rcx
leaq -0x40(%rbp), %r8
movb $0x0, %al
callq 0x1190
movslq -0x2c(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movslq -0x30(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movsd -0x40(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1b7ea
movq -0x28(%rbp), %rdi
leaq 0xb404(%rip), %rsi      # 0x26c88
leaq -0x2c(%rbp), %rdx
leaq -0x30(%rbp), %rcx
movb $0x0, %al
callq 0x1190
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
movl (%rcx), %ecx
shll %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jg 0x1b946
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
cmpq %rcx, %rax
jne 0x1b8f0
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x30(%rbp), %rcx
cmpq %rcx, %rax
je 0x1b930
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x30(%rbp), %rcx
cmpq %rcx, %rax
jne 0x1b936
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x34(%rbp), %ecx
shll %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
cmpq %rcx, %rax
jne 0x1b936
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0x1b938
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1b89a
movl -0x34(%rbp), %esi
leaq 0xab4b(%rip), %rdi      # 0x2649b
movb $0x0, %al
callq 0x1030
movq -0x8(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0xbc50
movq -0x8(%rbp), %rax
movl (%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x20(%rbp), %rdi
callq 0x1090
movq -0x28(%rbp), %rdi
callq 0x1090
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)