// File: GenisGE[P]evalAdmix/alloc.cpp
// Function: allocIntMatrix(int, int)
iMatrix *allocIntMatrix(int x, int y){
  try{
    iMatrix *tmp = new iMatrix();
    int **ppi = new int*[x];
    

    // int *curPtr = new int [x * y];
    for( int i = 0; i < x; ++i) {
      *(ppi + i) = new int[y];
      // curPtr += y;
    }
#if _fillup_
    for (int i=0;i<x;i++)
      for(int n=0;n<y;n++)
	ppi[i][n]=0;
#endif
    printf("\t-> Allocated: %.3f gig memory\n",(float)sizeof(int)*x*y/1000000000);
    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(int)*x*y/1000000000);
    printf("\t-> Allocation failed, likely cause: need more memory, will exit.\n");
    exit(0);
  }
}

// Assembly:
subq $0x58, %rsp
movl %edi, 0x54(%rsp)
movl %esi, 0x50(%rsp)
movl $0x10, %edi
callq 0x32a0
movq %rax, 0x10(%rsp)
jmp 0x13c5d
movq 0x10(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movq %rax, 0x48(%rsp)
movslq 0x54(%rsp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x3030
movq %rax, 0x8(%rsp)
jmp 0x13c94
movq 0x8(%rsp), %rax
movq %rax, 0x30(%rsp)
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x54(%rsp), %eax
jge 0x13d7a
movslq 0x50(%rsp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x3030
movq %rax, (%rsp)
jmp 0x13cda
movq (%rsp), %rdx
movq 0x30(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x13ca6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x13e56
movq 0x40(%rsp), %rdi
callq 0x30e0
movq %rax, 0x18(%rsp)
cvtsi2ssl 0x54(%rsp), %xmm0
movss 0x57a3(%rip), %xmm1     # 0x194d8
mulss %xmm1, %xmm0
cvtsi2ssl 0x50(%rsp), %xmm1
mulss %xmm1, %xmm0
movss 0x5791(%rip), %xmm1     # 0x194dc
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x57aa(%rip), %rdi      # 0x19504
movb $0x1, %al
callq 0x3040
jmp 0x13d63
leaq 0x571a(%rip), %rdi      # 0x19484
xorl %eax, %eax
callq 0x3040
jmp 0x13d73
xorl %edi, %edi
callq 0x3340
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
cmpl 0x54(%rsp), %eax
jge 0x13dd4
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
cmpl 0x50(%rsp), %eax
jge 0x13dc5
movq 0x30(%rsp), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x24(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x13d94
jmp 0x13dc7
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x13d82
cvtsi2ssl 0x54(%rsp), %xmm0
movss 0x56f6(%rip), %xmm1     # 0x194d8
mulss %xmm1, %xmm0
cvtsi2ssl 0x50(%rsp), %xmm1
mulss %xmm1, %xmm0
movss 0x56e4(%rip), %xmm1     # 0x194dc
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x56dd(%rip), %rdi      # 0x194e4
movb $0x1, %al
callq 0x3040
jmp 0x13e10
movq 0x30(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x8(%rax)
movl 0x54(%rsp), %ecx
movq 0x48(%rsp), %rax
movl %ecx, (%rax)
movl 0x50(%rsp), %ecx
movq 0x48(%rsp), %rax
movl %ecx, 0x4(%rax)
movq 0x48(%rsp), %rax
addq $0x58, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
callq 0x34b0
jmp 0x13e54
jmp 0x13e56
movq 0x40(%rsp), %rdi
callq 0x34f0
movq %rax, %rdi
callq 0x94a0
nopl (%rax,%rax)