// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
xorl %eax, %eax
movq %rax, -0xe0(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0xc0(%rbp)
movq %rax, -0xb0(%rbp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, -0xc8(%rbp)
movl %ebx, -0xe8(%rbp)
movl %eax, -0xa0(%rbp)
movups %xmm0, -0xd8(%rbp)
movq %rax, -0x88(%rbp)
movups %xmm0, -0x68(%rbp)
movq %rax, -0x58(%rbp)
movl %ebx, -0x70(%rbp)
movl %ebx, -0x90(%rbp)
movl %eax, -0x48(%rbp)
movups %xmm0, -0x80(%rbp)
callq 0xb216
cmpl %ebx, %eax
je 0xb64f
cmpl $0x1, %eax
jne 0xb576
movq %r15, %rdi
callq 0xb2b1
movq %rax, %r12
leaq -0xe8(%rbp), %rsi
movq %rax, %rdi
callq 0xb360
movq %r12, %rdi
callq 0x1100
jmp 0xb585
leaq -0xe8(%rbp), %rsi
movq %r15, %rdi
callq 0xb3c9
movq %r15, %rdi
callq 0xb216
cmpl $-0x1, %eax
je 0xb64f
cmpl $0x1, %eax
movq %r14, -0x38(%rbp)
movq %r13, -0x30(%rbp)
jne 0xb5c7
movq %r15, %rdi
callq 0xb2b1
movq %rax, %r15
leaq -0x90(%rbp), %rsi
movq %rax, %rdi
callq 0xb360
movq %r15, %rdi
callq 0x1100
jmp 0xb5d6
leaq -0x90(%rbp), %rsi
movq %r15, %rdi
callq 0xb3c9
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 0x62b0
movq %r14, %rdi
movq -0x38(%rbp), %r14
movq %r14, %rsi
movl %r15d, %edx
movq %rbx, %rcx
callq 0x64d1
cmpl $-0x1, %eax
je 0xb64a
movq %r12, %rdi
movq %r14, %rsi
movl %r13d, %edx
movq -0x30(%rbp), %rcx
callq 0x660e
xorl %eax, %eax
jmp 0xb64f
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq