// File: /workspace/github_cpp_makefile_star2_O2/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 $0xad8, %rsp            # imm = 0xAD8
movq %rdx, 0x48(%rsp)
movq %rsi, %r15
movl %edi, %ebx
leaq 0xf8(%rsp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x2450
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x118(%rsp,%rax)
jne 0x78b8
movq %r15, 0x30(%rsp)
leaq 0x88(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %rbx, 0x38(%rsp)
movl %ebx, %edi
callq 0x9753
movq %rax, 0x40(%rsp)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movl $0x0, 0x8(%rsp)
leaq 0x300(%rsp), %r15
leaq 0x50(%rsp), %rbp
leaq 0xb8(%rsp), %rbx
movl $0x0, 0x4(%rsp)
movq 0xf8(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x118(%rsp,%rax)
jne 0x7832
movl $0x7d0, %edx            # imm = 0x7D0
leaq 0xf8(%rsp), %rdi
movq %r15, %rsi
callq 0x20b0
movq %rbp, %rdi
movq %r15, %r12
movq %r15, %rsi
leaq 0xc(%rsp), %rdx
callq 0x5646
leaq 0x78(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x2290
movq %rbp, %rdi
callq 0x20f0
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x22f0
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
callq 0x22f0
leaq 0x98(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x5f0c
movl %eax, %r15d
movq %rbx, %r14
movq %rbx, %rdi
callq 0x20f0
movq %r13, %rdi
callq 0x20f0
testl $0xfffffffd, %r15d      # imm = 0xFFFFFFFD
jne 0x789a
testl %r15d, %r15d
je 0x781b
movq 0x50(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x23a0
movl %eax, 0xc(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x7dd8
movq %r14, %rbx
movl 0x4(%rsp), %esi
movslq %esi, %rax
movq 0x10(%rsp), %rcx
movl 0x8(%rsp), %edx
addl (%rcx,%rax,4), %edx
movl %edx, 0x8(%rsp)
incl %esi
movl %esi, 0x4(%rsp)
jmp 0x781e
movq %r14, %rbx
movq %rbp, %rdi
callq 0x7976
testl %r15d, %r15d
movq %r12, %r15
jne 0x7715
movq 0x10(%rsp), %rax
xorl %ecx, %ecx
movq 0x38(%rsp), %rdi
testl %edi, %edi
cmovlel %ecx, %edi
movq 0x40(%rsp), %r14
cmpq %rcx, %rdi
je 0x785c
movl (%rax,%rcx,4), %edx
movq 0x8(%r14), %rsi
movl %edx, (%rsi,%rcx,4)
incq %rcx
jmp 0x7848
movl 0x8(%rsp), %eax
movl %eax, 0x4(%r14)
leaq 0x10(%rsp), %rdi
callq 0x7d70
leaq 0x78(%rsp), %rdi
callq 0x20f0
leaq 0xf8(%rsp), %rdi
callq 0x2070
movq %r14, %rax
addq $0xad8, %rsp            # imm = 0xAD8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4a03(%rip), %rdi      # 0xc2a4
movq 0x30(%rsp), %rsi
movl 0x4(%rsp), %edx
xorl %eax, %eax
callq 0x2040
xorl %edi, %edi
callq 0x2280
leaq 0xd8(%rsp), %rdi
leaq 0x78(%rsp), %rdx
movq %r15, %rsi
callq 0x5646
leaq 0xd8(%rsp), %rbx
movq %rbx, %rdi
callq 0x590c
movq %rbx, %rdi
callq 0x20f0
jmp 0x78b1
movq %rax, %rbx
jmp 0x793f
movq %rax, %rbx
jmp 0x7935
jmp 0x78ff
jmp 0x78fa
movq %rax, %rbx
jmp 0x7914
movq %rax, %rbx
jmp 0x792b
movq %rax, %rbx
jmp 0x7921
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x20f0
leaq 0x98(%rsp), %rdi
callq 0x20f0
leaq 0x50(%rsp), %rdi
callq 0x7976
leaq 0x10(%rsp), %rdi
callq 0x7d70
leaq 0x78(%rsp), %rdi
callq 0x20f0
leaq 0xf8(%rsp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x2410