// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xac8, %rsp            # imm = 0xAC8
movq %rdx, %r15
movq %rsi, %r14
movl %edi, %ebp
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x2440
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x108(%rsp,%rax)
jne 0x8e66
movq %r14, 0xb8(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl %ebp, 0x8(%rsp)
movl %ebp, %edi
callq 0xad3f
movq %rax, 0xc0(%rsp)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x0, 0x4(%rsp)
leaq 0x2f0(%rsp), %r14
leaq 0x70(%rsp), %rbp
leaq 0x98(%rsp), %r12
xorl %ebx, %ebx
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x108(%rsp,%rax)
jne 0x8dc0
leaq (%rsp,%rax), %rdi
addq $0xe8, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %ecx
movl $0x7d0, %edx            # imm = 0x7D0
leaq 0xe8(%rsp), %rdi
movq %r14, %rsi
callq 0x2460
leaq 0x80(%rsp), %r13
movq %r13, 0x70(%rsp)
movq %r14, %rdi
callq 0x20d0
leaq (%rsp,%rax), %rdx
addq $0x2f0, %rdx            # imm = 0x2F0
movq %rbp, %rdi
movq %r14, %rsi
callq 0x618e
leaq 0x30(%rsp), %rdi
movq %rbp, %rsi
callq 0x22a0
movq 0x70(%rsp), %rdi
cmpq %r13, %rdi
je 0x8ca0
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2230
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rdi
callq 0x5f92
movq %r12, %r13
leaq 0xa8(%rsp), %rax
movq %rax, 0x98(%rsp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x5f92
leaq 0x50(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x694a
movl %eax, %r13d
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x8d32
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2230
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x8d4e
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2230
testl $0xfffffffd, %r13d      # imm = 0xFFFFFFFD
jne 0x8e47
testl %r13d, %r13d
je 0x8daf
movq 0x70(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x2390
movl %eax, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x8d8b
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x8d9a
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x934c
movslq %ebx, %rax
movq 0x10(%rsp), %rcx
movl 0x4(%rsp), %edx
addl (%rcx,%rax,4), %edx
movl %edx, 0x4(%rsp)
incl %ebx
movq %rbp, %rdi
callq 0x8f4c
testl %r13d, %r13d
jne 0x8c07
movl 0x8(%rsp), %edx
testl %edx, %edx
movq 0xc0(%rsp), %rbx
jle 0x8deb
movq 0x10(%rsp), %rax
movq 0x8(%rbx), %rcx
movl %edx, %edx
xorl %esi, %esi
movl (%rax,%rsi,4), %edi
movl %edi, (%rcx,%rsi,4)
incq %rsi
cmpq %rsi, %rdx
jne 0x8ddd
movl 0x4(%rsp), %eax
movl %eax, 0x4(%rbx)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8e09
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2230
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x8e25
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0xe8(%rsp), %rdi
callq 0x2070
movq %rbx, %rax
addq $0xac8, %rsp            # imm = 0xAC8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5496(%rip), %rdi      # 0xe2e4
movq 0xb8(%rsp), %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2040
xorl %edi, %edi
callq 0x2290
leaq 0xc8(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %r14, %rsi
callq 0x5efe
leaq 0xc8(%rsp), %rbx
movq %rbx, %rdi
callq 0x6220
movq %rbx, %rdi
callq 0x20e0
jmp 0x8e5f
movq %rax, %rbx
jmp 0x8f36
movq %rax, %rbx
jmp 0x8f1a
jmp 0x8eab
jmp 0x8f00
movq %rax, %rbx
jmp 0x8ed8
movq %rax, %rbx
jmp 0x8ef4
movq %rax, %rbx
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x8ed8
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2230
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x8ef4
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x70(%rsp), %rdi
callq 0x8f4c
jmp 0x8f03
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8f1a
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2230
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x8f36
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0xe8(%rsp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x2400
nop