// File: GenisGE[P]evalAdmix/alloc.cpp
// Function: allocFloatMatrix(unsigned long, unsigned long)
fMatrix *allocFloatMatrix(size_t x, size_t y){
  try{
    fMatrix *tmp = new fMatrix();
    float **ppi = new float*[x];
    float *curPtr = new float [x * y];
    
    for(unsigned long int i = 0; i < x; ++i) {
      *(ppi + i) = curPtr;
      curPtr += y;
    }
#if _fillup_
    for (unsigned long int i=0;i<x;i++)
      for(unsigned long int n=0;n<y;n++)
	ppi[i][n]=0;
#endif
    
    tmp->matrix=ppi;
    tmp->x=x;
    tmp->y=y;
    return tmp;
  }catch(std::exception & e){
    printf("\t-> Tried to allocate: %.3f gig memory\n",(float)sizeof(float)*x*y/1000000000);
    printf("\t-> Allocation failed, likely cause: need more memory, will exit.\n");
    exit(0);
  }

}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movl $0x10, %edi
callq 0x32a0
movq %rax, 0x28(%rsp)
jmp 0x154e5
movq 0x28(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movq %rax, 0x70(%rsp)
movq 0x80(%rsp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x3030
movq %rax, 0x20(%rsp)
jmp 0x1551f
movq 0x20(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x80(%rsp), %rax
movq 0x78(%rsp), %rcx
imulq %rcx, %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x3030
movq %rax, 0x18(%rsp)
jmp 0x1555c
movq 0x18(%rsp), %rax
movq %rax, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
movq 0x48(%rsp), %rax
cmpq 0x80(%rsp), %rax
jae 0x156c4
movq 0x50(%rsp), %rdx
movq 0x58(%rsp), %rax
movq 0x48(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x78(%rsp), %rax
shlq $0x2, %rax
addq 0x50(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x1556f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x15780
movq 0x68(%rsp), %rdi
callq 0x30e0
movq %rax, 0x30(%rsp)
movq 0x80(%rsp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, 0x10(%rsp)
testq %rax, %rax
movss %xmm0, 0x14(%rsp)
js 0x15627
movss 0x10(%rsp), %xmm0
movss %xmm0, 0x14(%rsp)
movss 0x14(%rsp), %xmm0
movss 0x3ea3(%rip), %xmm1     # 0x194d8
mulss %xmm1, %xmm0
movss %xmm0, 0x4(%rsp)
movq 0x78(%rsp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, 0x8(%rsp)
testq %rax, %rax
movss %xmm0, 0xc(%rsp)
js 0x1567d
movss 0x8(%rsp), %xmm0
movss %xmm0, 0xc(%rsp)
movss 0x4(%rsp), %xmm0
movss 0xc(%rsp), %xmm1
mulss %xmm1, %xmm0
movss 0x3e47(%rip), %xmm1     # 0x194dc
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x3e60(%rip), %rdi      # 0x19504
movb $0x1, %al
callq 0x3040
jmp 0x156ad
leaq 0x3dd0(%rip), %rdi      # 0x19484
xorl %eax, %eax
callq 0x3040
jmp 0x156bd
xorl %edi, %edi
callq 0x3340
movq $0x0, 0x40(%rsp)
movq 0x40(%rsp), %rax
cmpq 0x80(%rsp), %rax
jae 0x1572e
movq $0x0, 0x38(%rsp)
movq 0x38(%rsp), %rax
cmpq 0x78(%rsp), %rax
jae 0x1571c
movq 0x58(%rsp), %rax
movq 0x40(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x38(%rsp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
movq 0x38(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x38(%rsp)
jmp 0x156e5
jmp 0x1571e
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x156cd
movq 0x58(%rsp), %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x80(%rsp), %rax
movl %eax, %ecx
movq 0x70(%rsp), %rax
movl %ecx, (%rax)
movq 0x78(%rsp), %rax
movl %eax, %ecx
movq 0x70(%rsp), %rax
movl %ecx, 0x4(%rax)
movq 0x70(%rsp), %rax
addq $0x88, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
callq 0x34b0
jmp 0x1577e
jmp 0x15780
movq 0x68(%rsp), %rdi
callq 0x34f0
movq %rax, %rdi
callq 0x94a0
nopw %cs:(%rax,%rax)