// File: GenisGE[P]evalAdmix/alloc.cpp
// Function: allocUSIntMatrix(int, int)
usiMatrix *allocUSIntMatrix(int x, int y){
  try{
    usiMatrix *tmp = new usiMatrix();
    unsigned short int **ppi = new unsigned short int*[x];
    // int *curPtr = new int [x * y];
    for( int i = 0; i < x; ++i) {
      *(ppi + i) = new unsigned short 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(unsigned short 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 0x13e8d
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 0x13ec4
movq 0x8(%rsp), %rax
movq %rax, 0x30(%rsp)
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x54(%rsp), %eax
jge 0x13fa2
movslq 0x50(%rsp), %rdi
addq %rdi, %rdi
movq $-0x1, %rax
cmovbq %rax, %rdi
callq 0x3030
movq %rax, (%rsp)
jmp 0x13f02
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 0x13ed6
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 0x14075
movq 0x40(%rsp), %rdi
callq 0x30e0
movq %rax, 0x18(%rsp)
cvtsi2ssl 0x54(%rsp), %xmm0
movss 0x557b(%rip), %xmm1     # 0x194d8
mulss %xmm1, %xmm0
cvtsi2ssl 0x50(%rsp), %xmm1
mulss %xmm1, %xmm0
movss 0x5569(%rip), %xmm1     # 0x194dc
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x5582(%rip), %rdi      # 0x19504
movb $0x1, %al
callq 0x3040
jmp 0x13f8b
leaq 0x54f2(%rip), %rdi      # 0x19484
xorl %eax, %eax
callq 0x3040
jmp 0x13f9b
xorl %edi, %edi
callq 0x3340
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
cmpl 0x54(%rsp), %eax
jge 0x13ffb
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
cmpl 0x50(%rsp), %eax
jge 0x13fec
movq 0x30(%rsp), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x24(%rsp), %rcx
movw $0x0, (%rax,%rcx,2)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x13fbc
jmp 0x13fee
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x13faa
cvtsi2ssl 0x54(%rsp), %xmm0
addss %xmm0, %xmm0
cvtsi2ssl 0x50(%rsp), %xmm1
mulss %xmm1, %xmm0
movss 0x54c5(%rip), %xmm1     # 0x194dc
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x54be(%rip), %rdi      # 0x194e4
movb $0x1, %al
callq 0x3040
jmp 0x1402f
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 0x14073
jmp 0x14075
movq 0x40(%rsp), %rdi
callq 0x34f0
movq %rax, %rdi
callq 0x94a0
nopw (%rax,%rax)