// File: /workspace/github_c_makefile_star2_O2/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 0x5cf47(%rip), %rsi     # 0x9a28c
pushq $0x30
popq %rdi
pushq $0x4
popq %rdx
callq 0x34f59
movq %rax, %rbx
leaq 0x5e525(%rip), %rsi     # 0x9b87f
movq %r14, %rdi
callq 0x40f0
testq %rax, %rax
je 0x3d55d
movq %rax, %r14
leaq 0x637e4(%rip), %rsi     # 0xa0b59
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4070
movslq (%rbx), %rdi
shlq $0x3, %rdi
leaq 0x5cefc(%rip), %rsi     # 0x9a28c
pushq $0x7
popq %rdx
callq 0x34f59
movq %rax, 0x10(%rbx)
leaq 0x5c805(%rip), %r15     # 0x99ba8
xorl %r12d, %r12d
xorl %r13d, %r13d
movslq (%rbx), %rdi
cmpq %rdi, %r13
jge 0x3d3ce
movq 0x10(%rbx), %rdx
addq %r12, %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x4070
incq %r13
addq $0x8, %r12
jmp 0x3d3a9
shlq $0x2, %rdi
leaq 0x5ceb3(%rip), %r15     # 0x9a28c
pushq $0xa
popq %rdx
movq %r15, %rsi
callq 0x34f59
movq %rax, 0x8(%rbx)
movslq (%rbx), %rdi
shlq $0x3, %rdi
pushq $0xb
popq %rdx
movq %r15, %rsi
callq 0x34f59
movq %rax, 0x18(%rbx)
movslq (%rbx), %rdi
shlq $0x3, %rdi
pushq $0xc
popq %rdx
movq %r15, %rsi
callq 0x34f59
movq %rax, 0x20(%rbx)
movslq (%rbx), %rdi
shlq $0x3, %rdi
pushq $0xd
popq %rdx
movq %r15, %rsi
callq 0x34f59
movq %rax, 0x28(%rbx)
leaq 0x5c777(%rip), %rbp     # 0x99ba8
xorl %r13d, %r13d
movslq (%rbx), %rax
cmpq %rax, %r13
jge 0x3d4fd
leaq (,%r13,4), %rdx
addq 0x8(%rbx), %rdx
movq %r14, %rdi
leaq 0x63703(%rip), %rsi     # 0xa0b59
xorl %eax, %eax
callq 0x4070
movq 0x8(%rbx), %rax
movslq (%rax,%r13,4), %rdi
shlq $0x3, %rdi
leaq 0x5ce1c(%rip), %r15     # 0x9a28c
movq %r15, %rsi
pushq $0x11
popq %rdx
callq 0x34f59
movq 0x18(%rbx), %rcx
movq %rax, (%rcx,%r13,8)
movq 0x8(%rbx), %rax
movslq (%rax,%r13,4), %rdi
shlq $0x3, %rdi
movq %r15, %rsi
pushq $0x12
popq %rdx
callq 0x34f59
movq 0x20(%rbx), %rcx
movq %rax, (%rcx,%r13,8)
movq 0x8(%rbx), %rax
movslq (%rax,%r13,4), %rdi
shlq $0x3, %rdi
movq %r15, %rsi
pushq $0x13
popq %rdx
callq 0x34f59
movq 0x28(%rbx), %rcx
movq %rax, (%rcx,%r13,8)
xorl %r12d, %r12d
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movslq (%rax,%r13,4), %rax
cmpq %rax, %r15
jge 0x3d4f5
movq 0x18(%rbx), %rax
movq (%rax,%r13,8), %rdx
addq %r12, %rdx
movq %r14, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x4070
incq %r15
addq $0x8, %r12
jmp 0x3d4c7
incq %r13
jmp 0x3d434
leaq 0x5c85f(%rip), %r15     # 0x99d63
xorl %r12d, %r12d
cltq
cmpq %rax, %r12
jge 0x3d553
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x8(%rbx), %rax
movslq (%rax,%r12,4), %rax
cmpq %rax, %rbp
jge 0x3d54c
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
addq $0x8, %r13
jmp 0x3d513
incq %r12
movl (%rbx), %eax
jmp 0x3d507
movq %r14, %rdi
callq 0x42a0
jmp 0x3d55f
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq