// File: GenisGE[P]evalAdmix/filereader_and_conversions.cpp
// Function: doUseIndsArray(int, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bArray *doUseIndsArray(int nInd, const char *filename, const std::string delim){

  std::ifstream useIndsFile (filename, std::ios::in);

  const int SIZE=2000;
  char buffer[SIZE];
  
  if(!useIndsFile){
    fileError(filename);
    exit(0);
      }

  std::string tmp_string;
  bArray *ret = allocBoolArray(nInd);
  std::vector<int> useIndstmp;
  int numTrue = 0;
  int numRows=0;
  int itemsInRow;
  while(!useIndsFile.eof()){

    useIndsFile.getline(buffer,SIZE);

    tmp_string = std::string(buffer);
    std::vector<std::string> tokens;
    itemsInRow = get_lexemes(tmp_string, tokens, delim);
        if (itemsInRow!=2 && itemsInRow!=0){
     printf("useInds file:%s doesn't have 2 columns in row:%d\n",filename,numRows);
     exit(0);
    }else if(itemsInRow==0)
     break;

    useIndstmp.push_back(atoi(tokens[1].c_str()));
    
    numTrue += useIndstmp[numRows];
    
    numRows++;
    
  }

  for(int i=0;i<nInd;i++)
    ret->array[i] = useIndstmp[i];

  ret-> numTrue = numTrue;

  return ret;
}

// Assembly:
subq $0xb68, %rsp            # imm = 0xB68
movq %rdx, 0x50(%rsp)
movl %edi, 0xb64(%rsp)
movq %rsi, 0xb58(%rsp)
movq %rdx, 0xb50(%rsp)
movq 0xb58(%rsp), %rsi
leaq 0x948(%rsp), %rdi
movl $0x8, %edx
callq 0x3540
movl $0x7d0, 0x944(%rsp) # imm = 0x7D0
movq 0x948(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x948(%rsp,%rax), %rdi
callq 0x3120
movb %al, 0x5b(%rsp)
jmp 0xd957
movb 0x5b(%rsp), %al
testb $0x1, %al
jne 0xd964
jmp 0xda2e
movq 0xb58(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x13f(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x3500
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
leaq 0x140(%rsp), %rdi
callq 0x9280
jmp 0xd99c
leaq 0x140(%rsp), %rdi
callq 0xa100
jmp 0xd9ab
leaq 0x140(%rsp), %rdi
callq 0x3170
leaq 0x13f(%rsp), %rdi
callq 0x32e0
xorl %edi, %edi
callq 0x3340
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0xde16
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0xda1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0x140(%rsp), %rdi
callq 0x3170
leaq 0x13f(%rsp), %rdi
callq 0x32e0
jmp 0xde16
leaq 0x118(%rsp), %rdi
callq 0x33a0
movl 0xb64(%rsp), %edi
callq 0x14900
movq %rax, 0x38(%rsp)
jmp 0xda4e
movq 0x38(%rsp), %rax
movq %rax, 0x110(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xe030
movl $0x0, 0xf4(%rsp)
movl $0x0, 0xf0(%rsp)
movq 0x948(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x948(%rsp,%rax), %rdi
callq 0x3550
movb %al, 0x37(%rsp)
jmp 0xda9d
movb 0x37(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xdaac
jmp 0xdd57
leaq 0x948(%rsp), %rdi
leaq 0x170(%rsp), %rsi
movl $0x7d0, %edx            # imm = 0x7D0
callq 0x30c0
jmp 0xdac8
leaq 0xc7(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x3500
movq 0x28(%rsp), %rdx
leaq 0xc8(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x9280
jmp 0xdaf6
leaq 0x118(%rsp), %rdi
movq %rdi, 0x20(%rsp)
leaq 0xc8(%rsp), %rsi
movq %rsi, 0x18(%rsp)
callq 0x3350
movq 0x18(%rsp), %rdi
callq 0x3170
leaq 0xc7(%rsp), %rdi
callq 0x32e0
leaq 0xa8(%rsp), %rdi
callq 0xdec0
movq 0x20(%rsp), %rsi
leaq 0x88(%rsp), %rdi
callq 0x3100
jmp 0xdb4d
movq 0x50(%rsp), %rsi
leaq 0x68(%rsp), %rdi
callq 0x3100
jmp 0xdb5e
leaq 0x88(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0xab60
movl %eax, 0x14(%rsp)
jmp 0xdb7e
movl 0x14(%rsp), %eax
movl %eax, 0xec(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x3170
leaq 0x88(%rsp), %rdi
callq 0x3170
cmpl $0x2, 0xec(%rsp)
je 0xdc99
cmpl $0x0, 0xec(%rsp)
je 0xdc99
movq 0xb58(%rsp), %rsi
movl 0xf0(%rsp), %edx
leaq 0xb74e(%rip), %rdi      # 0x19320
xorl %eax, %eax
callq 0x3040
jmp 0xdbdb
xorl %edi, %edi
callq 0x3340
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0xde09
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0xddfc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0xc7(%rsp), %rdi
callq 0x32e0
jmp 0xddfc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0xdd45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0xdc87
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x3170
leaq 0x88(%rsp), %rdi
callq 0x3170
jmp 0xdd45
cmpl $0x0, 0xec(%rsp)
jne 0xdcad
movl $0x3, 0x64(%rsp)
jmp 0xdd27
jmp 0xdcaf
leaq 0xa8(%rsp), %rdi
movl $0x1, %esi
callq 0xdf30
movq %rax, %rdi
callq 0x30f0
movq %rax, %rdi
callq 0x3460
movl %eax, 0x60(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0xe050
jmp 0xdce9
movslq 0xf0(%rsp), %rsi
leaq 0xf8(%rsp), %rdi
callq 0xe0f0
movl (%rax), %eax
addl 0xf4(%rsp), %eax
movl %eax, 0xf4(%rsp)
movl 0xf0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xf0(%rsp)
movl $0x0, 0x64(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0xded0
movl 0x64(%rsp), %eax
testl %eax, %eax
je 0xdd40
jmp 0xdd3e
jmp 0xdd57
jmp 0xda7e
leaq 0xa8(%rsp), %rdi
callq 0xded0
jmp 0xddfc
movl $0x0, 0x5c(%rsp)
movl 0x5c(%rsp), %eax
cmpl 0xb64(%rsp), %eax
jge 0xdda1
movslq 0x5c(%rsp), %rsi
leaq 0xf8(%rsp), %rdi
callq 0xe0f0
movl (%rax), %edx
movq 0x110(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x5c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0xdd5f
movl 0xf4(%rsp), %ecx
movq 0x110(%rsp), %rax
movl %ecx, 0x4(%rax)
movq 0x110(%rsp), %rax
movq %rax, 0x8(%rsp)
movl $0x1, 0x64(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xe170
leaq 0x118(%rsp), %rdi
callq 0x3170
leaq 0x948(%rsp), %rdi
callq 0x3080
movq 0x8(%rsp), %rax
addq $0xb68, %rsp            # imm = 0xB68
retq
leaq 0xf8(%rsp), %rdi
callq 0xe170
leaq 0x118(%rsp), %rdi
callq 0x3170
leaq 0x948(%rsp), %rdi
callq 0x3080
movq 0x168(%rsp), %rdi
callq 0x34f0