// File: /workspace/github_cpp_makefile_star2_O2/dcarrey[P]hgt-detection/./fonctions.cpp
// Function: readInputFile(_IO_FILE*, char const*, char*)
int readInputFile(FILE *in, const char *tmpFile/*, struct InputTree *speciesTree, struct InputTree *geneTree*/,char *fichier_erreur){
	
	char *newick;
	struct InputTree speciesTree_t;
	struct InputTree geneTree_t;
	int ret;

	initInputTree(&speciesTree_t);
	initInputTree(&geneTree_t);

	//== read the species tree
  ret = nextTreeIsNewick(in);
	if(ret==-1)
		return -1;
	else if(ret==1){
		newick = readNewick(in);
		ret = (int)strlen(newick);
		newickToMatrix(newick,&speciesTree_t);
		free(newick);
	}
	else
		readMatrix(in,&speciesTree_t);
	
	//== read the gene tree
	ret = nextTreeIsNewick(in);
	if(ret==-1)
		return -1;
	else if(ret==1){
		newick = readNewick(in);
		newickToMatrix(newick,&geneTree_t);
		free(newick);
	}
	else
		readMatrix(in,&geneTree_t);
//	printf("%d--%d",speciesTree_t.size,geneTree_t.size);
	filtrerMatrice(speciesTree_t.Input,geneTree_t.Input,speciesTree_t.SpeciesName,geneTree_t.SpeciesName,speciesTree_t.size,geneTree_t.size,fichier_erreur);
//	printf("%d--%d",speciesTree_t.size,geneTree_t.size);

	if(ecrireMatrice(speciesTree_t.Input,tmpFile,speciesTree_t.size,speciesTree_t.SpeciesName) == -1)
		return -2;
	ajouterMatriceGene(geneTree_t.Input,tmpFile,geneTree_t.size,geneTree_t.SpeciesName);
	/*
	TrierMatrices(geneTree_t.Input,geneTree_t.SpeciesName,speciesTree_t.SpeciesName,speciesTree_t.size);
	
  (*speciesTree) = speciesTree_t;
  (*geneTree)    = geneTree_t;
  */
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
andq $0x0, -0xe0(%rbp)
xorps %xmm0, %xmm0
andq $0x0, -0xb0(%rbp)
movups %xmm0, -0xc0(%rbp)
orl $-0x1, -0xc8(%rbp)
orl $-0x1, -0xe8(%rbp)
movq %rdx, %r14
andl $0x0, -0xa0(%rbp)
movq %rsi, %rbx
andq $0x0, -0x88(%rbp)
movq %rdi, %r15
andq $0x0, -0x58(%rbp)
movups %xmm0, -0x68(%rbp)
orl $-0x1, -0x70(%rbp)
movups %xmm0, -0xd8(%rbp)
orl $-0x1, -0x90(%rbp)
andl $0x0, -0x48(%rbp)
movups %xmm0, -0x80(%rbp)
callq 0xa2a3
pushq $-0x1
popq %rcx
cmpl %ecx, %eax
je 0xa688
cmpl $0x1, %eax
jne 0xa5b1
movq %r15, %rdi
callq 0xa319
movq %rax, %r12
leaq -0xe8(%rbp), %rsi
movq %rax, %rdi
callq 0xa3c8
movq %r12, %rdi
callq 0x10f0
jmp 0xa5c0
leaq -0xe8(%rbp), %rsi
movq %r15, %rdi
callq 0xa431
movq %r15, %rdi
callq 0xa2a3
cmpl $-0x1, %eax
je 0xa688
cmpl $0x1, %eax
movq %rbx, -0x38(%rbp)
movq %r14, -0x30(%rbp)
jne 0xa602
movq %r15, %rdi
callq 0xa319
movq %rax, %r15
leaq -0x90(%rbp), %rsi
movq %rax, %rdi
callq 0xa3c8
movq %r15, %rdi
callq 0x10f0
jmp 0xa611
leaq -0x90(%rbp), %rsi
movq %r15, %rdi
callq 0xa431
movq -0xd8(%rbp), %r14
movq -0x80(%rbp), %r12
movq -0xd0(%rbp), %rbx
movq -0x78(%rbp), %rcx
movl -0xe8(%rbp), %r15d
movl -0x90(%rbp), %r13d
movq -0x30(%rbp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %rcx, -0x30(%rbp)
movl %r15d, %r8d
movl %r13d, %r9d
callq 0x585e
movq %r14, %rdi
movq -0x38(%rbp), %r14
movq %r14, %rsi
movl %r15d, %edx
movq %rbx, %rcx
callq 0x5a5c
cmpl $-0x1, %eax
je 0xa685
movq %r12, %rdi
movq %r14, %rsi
movl %r13d, %edx
movq -0x30(%rbp), %rcx
callq 0x5b95
xorl %eax, %eax
jmp 0xa688
pushq $-0x2
popq %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq