// File: /workspace/github_cpp_makefile_star2_O2/GenisGE[P]evalAdmix/Cinterface.cpp
// Function: readDouble(double**, int, int, char const*, int)
void readDouble(double **d,int x,int y,const char*fname,int neg){
  fprintf(stderr,"opening : %s with x=%d y=%d\n",fname,x,y);
  const char*delims=" \n";
  FILE *fp = NULL;
  if((fp=fopen(fname,"r"))==NULL){
    fprintf(stderr,"can't open:%s\n",fname);
    exit(0);
  }
  int lens=1000000 ;
  char buf[lens];
  for(int i=0;i<x;i++){
    if(NULL==fgets(buf,lens,fp)){
    	fprintf(stderr,"Error: Only %d individuals in admxiture (-qname) file\n",i);
      exit(0);
    }
    if(neg)
      d[i][0] = 1-atof(strtok(buf,delims));
    else
      d[i][0] = atof(strtok(buf,delims));
    for(int j=1;j<y;j++){
      //      fprintf(stderr,"i=%d j=%d\n",i,j);
      if(neg)
	d[i][j] = 1-atof(strtok(NULL,delims));
      else
	d[i][j] = atof(strtok(NULL,delims));
    }
  }
   if(NULL!=fgets(buf,lens,fp)){
    fprintf(stderr,"Error: Too many individuals in admixture (-qname) file. Only %d individuals in plink file\n",x);
    exit(0);
  }

  fclose(fp); 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %r15d
movq %rcx, %rbx
movl %edx, %r8d
movl %esi, %r13d
movq %rdi, %r12
movq 0xde42(%rip), %rax      # 0x10fd8
movq (%rax), %rdi
leaq 0x8019(%rip), %rsi      # 0xb1b9
xorl %r14d, %r14d
movq %rcx, %rdx
movl %r13d, %ecx
movl %r8d, -0x30(%rbp)
xorl %eax, %eax
callq 0x2320
leaq 0x7f3c(%rip), %rsi      # 0xb0f7
movq %rbx, %rdi
callq 0x2260
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0x32dc
movq %rsp, %rax
addq $-0xf4240, %rax         # imm = 0xFFF0BDC0
movq %rax, -0x40(%rbp)
movq %rax, %rsp
testl %r13d, %r13d
movl $0x0, %eax
movl %r13d, -0x2c(%rbp)
cmovgl %r13d, %eax
movq %rax, -0x48(%rbp)
movslq -0x30(%rbp), %rbx
movq -0x40(%rbp), %rdi
movl $0xf4240, %esi          # imm = 0xF4240
movq -0x38(%rbp), %rdx
callq 0x23c0
cmpq -0x48(%rbp), %r14
je 0x329d
testq %rax, %rax
je 0x32ba
movq -0x40(%rbp), %rdi
leaq 0x7ecc(%rip), %rsi      # 0xb0f4
callq 0x23b0
movq %rax, %rdi
callq 0x22a0
testl %r15d, %r15d
je 0x324a
movsd 0x7dc6(%rip), %xmm1     # 0xb008
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
movq (%r12,%r14,8), %rax
movsd %xmm0, (%rax)
pushq $0x1
popq %r13
cmpq %rbx, %r13
jge 0x3295
xorl %edi, %edi
leaq 0x7e90(%rip), %rsi      # 0xb0f4
callq 0x23b0
movq %rax, %rdi
callq 0x22a0
testl %r15d, %r15d
je 0x3286
movsd 0x7d8a(%rip), %xmm1     # 0xb008
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
movq (%r12,%r14,8), %rax
movsd %xmm0, (%rax,%r13,8)
incq %r13
jmp 0x3256
incq %r14
jmp 0x31f8
testq %rax, %rax
jne 0x32f9
movq -0x38(%rbp), %rdi
callq 0x2210
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xdd17(%rip), %rax      # 0x10fd8
movq (%rax), %rdi
leaq 0x7fc7(%rip), %rsi      # 0xb292
movl %r14d, %edx
xorl %eax, %eax
callq 0x2320
xorl %edi, %edi
callq 0x2280
movq 0xdcf5(%rip), %rax      # 0x10fd8
movq (%rax), %rdi
leaq 0x7f96(%rip), %rsi      # 0xb283
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2320
jmp 0x32d5
movq 0xdcd8(%rip), %rax      # 0x10fd8
movq (%rax), %rdi
leaq 0x7fbf(%rip), %rsi      # 0xb2c9
movl -0x2c(%rbp), %edx
jmp 0x32ce