// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/mixture.c
// Function: read_mixture_from_file
Mixtureptr read_mixture_from_file(char* modeldefinition)
{
	/*!Last Changed 26.01.2005*/
	int i, j;
	FILE* infile;
	Mixtureptr mix;
	mix = safemalloc(sizeof(Mixture), "read_mixture_from_file", 4);
	infile = fopen(modeldefinition, "r");
	if (!infile)
		 return NULL;
	fscanf(infile, "%d", &(mix->classcount));
	mix->classpriors = safemalloc(mix->classcount * sizeof(double), "read_mixture_from_file", 7);
	for (i = 0; i < mix->classcount; i++)
		 fscanf(infile, "%lf", &(mix->classpriors[i]));
	mix->numberofmodels = safemalloc(mix->classcount * sizeof(int), "read_mixture_from_file", 10);
 mix->mixtureprob = safemalloc(mix->classcount * sizeof(double*), "read_mixture_from_file", 11);
 mix->mixturemeans = safemalloc(mix->classcount * sizeof(double*), "read_mixture_from_file", 12);
 mix->mixturedeviations = safemalloc(mix->classcount * sizeof(double*), "read_mixture_from_file", 13);
 for (i = 0; i < mix->classcount; i++)
	 {
		 fscanf(infile, "%d", &(mix->numberofmodels[i]));
   mix->mixtureprob[i] = safemalloc(mix->numberofmodels[i] * sizeof(double), "read_mixture_from_file", 17);
   mix->mixturemeans[i] = safemalloc(mix->numberofmodels[i] * sizeof(double), "read_mixture_from_file", 18);
   mix->mixturedeviations[i] = safemalloc(mix->numberofmodels[i] * sizeof(double), "read_mixture_from_file", 19);
			for (j = 0; j < mix->numberofmodels[i]; j++)
				 fscanf(infile, "%lf", &(mix->mixtureprob[i][j]));
	 }
	for (i = 0; i < mix->classcount; i++)
		 for (j = 0; j < mix->numberofmodels[i]; j++)
				 fscanf(infile, "%lf%lf", &(mix->mixturemeans[i][j]), &(mix->mixturedeviations[i][j]));
	fclose(infile);
	return mix;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x64e9f(%rip), %rsi     # 0xa72bc
movl $0x30, %edi
movl $0x4, %edx
callq 0x390f5
movq %rax, %rbx
leaq 0x66459(%rip), %rsi     # 0xa888f
movq %r14, %rdi
callq 0x40f0
testq %rax, %rax
je 0x42666
movq %rax, %r14
leaq 0x6b70c(%rip), %rsi     # 0xadb5d
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4070
movslq (%rbx), %rdi
shlq $0x3, %rdi
leaq 0x64e50(%rip), %rsi     # 0xa72bc
movl $0x7, %edx
callq 0x390f5
movq %rax, 0x10(%rbx)
movl (%rbx), %eax
testl %eax, %eax
jle 0x424b0
leaq 0x64789(%rip), %r15     # 0xa6c10
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x10(%rbx), %rdx
addq %r12, %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x4070
incq %r13
movslq (%rbx), %rax
addq $0x8, %r12
cmpq %rax, %r13
jl 0x4248d
movslq %eax, %rdi
shlq $0x2, %rdi
leaq 0x64dfe(%rip), %r15     # 0xa72bc
movq %r15, %rsi
movl $0xa, %edx
callq 0x390f5
movq %rax, 0x8(%rbx)
movslq (%rbx), %rdi
shlq $0x3, %rdi
movq %r15, %rsi
movl $0xb, %edx
callq 0x390f5
movq %rax, 0x18(%rbx)
movslq (%rbx), %rdi
shlq $0x3, %rdi
movq %r15, %rsi
movl $0xc, %edx
callq 0x390f5
movq %rax, 0x20(%rbx)
movslq (%rbx), %rdi
shlq $0x3, %rdi
movq %r15, %rsi
movl $0xd, %edx
callq 0x390f5
movq %rax, 0x28(%rbx)
cmpl $0x0, (%rbx)
jle 0x425fb
leaq 0x646e9(%rip), %r13     # 0xa6c10
xorl %ebp, %ebp
leaq (,%rbp,4), %rdx
addq 0x8(%rbx), %rdx
movq %r14, %rdi
leaq 0x6b61e(%rip), %rsi     # 0xadb5d
xorl %eax, %eax
callq 0x4070
movq 0x8(%rbx), %rax
movslq (%rax,%rbp,4), %rdi
shlq $0x3, %rdi
leaq 0x64d63(%rip), %r15     # 0xa72bc
movq %r15, %rsi
movl $0x11, %edx
callq 0x390f5
movq 0x18(%rbx), %rcx
movq %rax, (%rcx,%rbp,8)
movq 0x8(%rbx), %rax
movslq (%rax,%rbp,4), %rdi
shlq $0x3, %rdi
movq %r15, %rsi
movl $0x12, %edx
callq 0x390f5
movq 0x20(%rbx), %rcx
movq %rax, (%rcx,%rbp,8)
movq 0x8(%rbx), %rax
movslq (%rax,%rbp,4), %rdi
shlq $0x3, %rdi
movq %r15, %rsi
movl $0x13, %edx
callq 0x390f5
movq 0x28(%rbx), %rcx
movq %rax, (%rcx,%rbp,8)
movq 0x8(%rbx), %rax
cmpl $0x0, (%rax,%rbp,4)
jle 0x425ec
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
movq (%rax,%rbp,8), %rdx
addq %r15, %rdx
movq %r14, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x4070
incq %r12
movq 0x8(%rbx), %rax
movslq (%rax,%rbp,4), %rax
addq $0x8, %r15
cmpq %rax, %r12
jl 0x425c0
incq %rbp
movslq (%rbx), %rax
cmpq %rax, %rbp
jl 0x42529
cmpl $0x0, (%rbx)
jle 0x4265c
leaq 0x647c4(%rip), %r15     # 0xa6dcb
xorl %r12d, %r12d
movq 0x8(%rbx), %rax
cmpl $0x0, (%rax,%r12,4)
jle 0x42651
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %rcx
movq (%rax,%r12,8), %rdx
addq %r13, %rdx
movq (%rcx,%r12,8), %rcx
addq %r13, %rcx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x4070
incq %rbp
movq 0x8(%rbx), %rax
movslq (%rax,%r12,4), %rax
addq $0x8, %r13
cmpq %rax, %rbp
jl 0x4261a
incq %r12
movslq (%rbx), %rax
cmpq %rax, %r12
jl 0x4260a
movq %r14, %rdi
callq 0x42a0
jmp 0x42668
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq