// File: /workspace/github_cpp_makefile_star2_O2/dcarrey[P]hgt-detection/./utils_tree.cpp
// Function: TrierMatrices(double**, char**, char**, int)
void TrierMatrices(double **DISS,char **NomsDISS,char **NomsADD,int n)
{
	int trouve, ligne,colonne,i,j;
	double ** DISS_;
	char   ** NomsDISS_;
	char noms[50];
	int * table;
	

	table = (int *) malloc((n+1)*sizeof(int));
	DISS_ = (double **) malloc((n+1)*sizeof(double*));
	NomsDISS_ = (char **) malloc((n+1)*sizeof(char*));

	for (i=0;i<=n;i++)
	{
		DISS_[i]=(double*)malloc((n+1)*sizeof(double));
		NomsDISS_[i] = (char*) malloc((n+1)*sizeof(15));
	}

	for(ligne = 1;ligne<=n;ligne++)
	{
		strcpy(noms,NomsADD[ligne]);
		trouve = 0;
		for(colonne = 1;colonne<=n;colonne++)
		{
			if(strcmp(noms,NomsDISS[colonne])==0)
			{
				trouve = 1;
				table[ligne] = colonne;
				strcpy(NomsDISS_[ligne],noms);
			}
		}
		if(trouve==0)
		{
			printf("\n%s %s",noms,"is not in the gene matrix.This program must stop");
			exit (-1);	
		}
	}

	for(i=1;i<=n;i++)
		for(j=1;j<=i;j++) DISS_[i][j] = DISS_[j][i] = DISS[table[i]][table[j]];

	for(i=1;i<=n;i++)
	{
		strcpy(NomsDISS[i],NomsDISS_[i]);
		for(j=1;j<=n;j++) DISS[i][j] = DISS_[i][j];
	}
//exit(0);
	for (i=0;i<=n;i++)
	{
		free(DISS_[i]);
		free(NomsDISS_[i]);
	}

	free(DISS_);
    free(NomsDISS_);
	free(table);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %ecx, %ebx
movq %rdx, -0x68(%rbp)
movq %rsi, -0x60(%rbp)
movq %rdi, -0x48(%rbp)
leal 0x1(%rbx), %eax
movl %eax, -0x2c(%rbp)
movslq %eax, %r15
leaq (,%r15,4), %rdi
movq %rdi, %r12
callq 0x1130
movq %rax, -0x58(%rbp)
shlq $0x3, %r15
movq %r15, %rdi
callq 0x1130
movq %rax, %r14
movq %r15, %rdi
callq 0x1130
movq %rax, -0x38(%rbp)
movq %rbx, %r13
movslq %ebx, %rax
movq %rax, -0x50(%rbp)
xorl %ebx, %ebx
cmpq -0x50(%rbp), %rbx
jg 0x5d19
movq %r15, %rdi
callq 0x1130
movq %rax, (%r14,%rbx,8)
movq %r12, %rdi
callq 0x1130
movq -0x38(%rbp), %rcx
movq %rax, (%rcx,%rbx,8)
incq %rbx
jmp 0x5cf2
xorl %eax, %eax
testl %r13d, %r13d
cmovgl %r13d, %eax
incl %eax
movq %rax, -0x40(%rbp)
movl -0x2c(%rbp), %r12d
pushq $0x1
popq %r13
leaq -0xa0(%rbp), %r15
cmpq -0x40(%rbp), %r13
je 0x5dc4
movq -0x68(%rbp), %rax
movq (%rax,%r13,8), %rsi
movq %r15, %rdi
callq 0x1070
movl $0x0, -0x2c(%rbp)
pushq $0x1
popq %rbx
cmpq %rbx, %r12
je 0x5d97
movq -0x60(%rbp), %rax
movq (%rax,%rbx,8), %rsi
movq %r15, %rdi
callq 0x1160
testl %eax, %eax
jne 0x5d92
movq -0x58(%rbp), %rax
movl %ebx, (%rax,%r13,4)
movq -0x38(%rbp), %rax
movq (%rax,%r13,8), %rdi
movq %r15, %rsi
callq 0x1070
pushq $0x1
popq %rax
movl %eax, -0x2c(%rbp)
incq %rbx
jmp 0x5d5b
incq %r13
cmpl $0x0, -0x2c(%rbp)
jne 0x5d37
leaq 0xea2a(%rip), %rdi      # 0x147d1
leaq 0xea2a(%rip), %rdx      # 0x147d8
leaq -0xa0(%rbp), %rsi
xorl %eax, %eax
callq 0x1030
pushq $-0x1
popq %rdi
callq 0x1100
pushq $0x1
popq %rax
movq -0x58(%rbp), %r13
movq -0x48(%rbp), %r8
cmpq -0x40(%rbp), %rax
je 0x5e0d
movslq (%r13,%rax,4), %rcx
movq (%r8,%rcx,8), %rcx
movq (%r14,%rax,8), %rdx
xorl %esi, %esi
cmpq %rsi, %rax
je 0x5e08
movslq 0x4(%r13,%rsi,4), %rdi
movsd (%rcx,%rdi,8), %xmm0
movq 0x8(%r14,%rsi,8), %rdi
movsd %xmm0, (%rdi,%rax,8)
movsd %xmm0, 0x8(%rdx,%rsi,8)
incq %rsi
jmp 0x5de4
incq %rax
jmp 0x5dcf
pushq $0x1
popq %rbx
movq %rbx, %r15
cmpq -0x40(%rbp), %r15
je 0x5e56
movq -0x60(%rbp), %rax
movq (%rax,%r15,8), %rdi
movq -0x38(%rbp), %rax
movq (%rax,%r15,8), %rsi
callq 0x1070
movq -0x48(%rbp), %rdx
movq %rbx, %rax
cmpq %rax, %r12
je 0x5e51
movq (%r14,%r15,8), %rcx
movsd (%rcx,%rax,8), %xmm0
movq (%rdx,%r15,8), %rcx
movsd %xmm0, (%rcx,%rax,8)
incq %rax
jmp 0x5e35
incq %r15
jmp 0x5e13
xorl %ebx, %ebx
cmpq -0x50(%rbp), %rbx
jg 0x5e79
movq (%r14,%rbx,8), %rdi
callq 0x10f0
movq -0x38(%rbp), %rax
movq (%rax,%rbx,8), %rdi
callq 0x10f0
incq %rbx
jmp 0x5e58
movq %r14, %rdi
callq 0x10f0
movq -0x38(%rbp), %rdi
callq 0x10f0
movq %r13, %rdi
callq 0x10f0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq