// File: /workspace/github_cpp_makefile_star2_O3/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, 0xc0(%rsp)
movl %edi, %ebp
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
movq %rsi, 0x38(%rsp)
movl $0x8, %edx
callq 0x2440
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x108(%rsp,%rax)
jne 0x8f18
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl %ebp, 0x18(%rsp)
movl %ebp, %edi
callq 0xae94
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
movl $0x0, 0xc(%rsp)
testb $0x2, 0x108(%rsp,%rax)
jne 0x8e69
leaq (%rsp,%rax), %rdi
addq $0xe8, %rdi
xorl %r12d, %r12d
leaq 0x2f0(%rsp), %rbx
leaq 0x60(%rsp), %r15
leaq 0xa0(%rsp), %r14
movl $0x0, 0xc(%rsp)
movl $0xa, %esi
callq 0x2200
movsbl %al, %ecx
movl $0x7d0, %edx            # imm = 0x7D0
leaq 0xe8(%rsp), %rdi
movq %rbx, %rsi
callq 0x2460
leaq 0x70(%rsp), %r13
movq %r13, 0x60(%rsp)
movq %rbx, %rdi
callq 0x20d0
leaq (%rsp,%rax), %rdx
addq $0x2f0, %rdx            # imm = 0x2F0
movq %r15, %rdi
movq %rbx, %rbp
movq %rbx, %rsi
callq 0x61b8
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x22a0
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x8d06
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x2230
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x5fae
movq %r14, %r13
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xc0(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x5fae
leaq 0x80(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x698a
movl %eax, %r13d
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x8da9
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x2230
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x8dce
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2230
testl $0xfffffffd, %r13d      # imm = 0xFFFFFFFD
jne 0x8efb
testl %r13d, %r13d
je 0x8e5f
movq 0x60(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x2390
movl %eax, 0x1c(%rsp)
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x8e0e
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
movq %rbp, %rbx
jmp 0x8e20
leaq 0x20(%rsp), %rdi
leaq 0x1c(%rsp), %rdx
callq 0x9416
movq %rbp, %rbx
movq 0x20(%rsp), %rax
movl 0xc(%rsp), %ecx
addl (%rax,%r12,4), %ecx
movl %ecx, 0xc(%rsp)
incq %r12
movq %r15, %rdi
callq 0x900c
movq 0xe8(%rsp), %rax
movq -0x18(%rax), %rax
leaq (%rsp,%rax), %rdi
addq $0xe8, %rdi
testb $0x2, 0x20(%rdi)
je 0x8c95
jmp 0x8e69
leaq 0x60(%rsp), %rdi
callq 0x900c
movq 0x20(%rsp), %rdi
movl 0x18(%rsp), %ecx
testl %ecx, %ecx
jle 0x8e9f
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movl %ecx, %ecx
xorl %edx, %edx
movl (%rdi,%rdx,4), %esi
movl %esi, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0x8e83
movq 0x10(%rsp), %rbx
movl 0xc(%rsp), %eax
movl %eax, 0x4(%rbx)
jmp 0x8eb0
movq 0x10(%rsp), %rbx
movl 0xc(%rsp), %eax
movl %eax, 0x4(%rbx)
testq %rdi, %rdi
je 0x8ebd
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2230
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x8ed9
movq 0x50(%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 0x53e2(%rip), %rdi      # 0xe2e4
movq 0x38(%rsp), %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x2040
xorl %edi, %edi
callq 0x2290
leaq 0xc8(%rsp), %rdi
leaq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rsi
callq 0x5f1a
leaq 0xc8(%rsp), %rbx
movq %rbx, %rdi
callq 0x6250
movq %rbx, %rdi
callq 0x20e0
jmp 0x8f11
movq %rax, %rbx
jmp 0x8ff6
movq %rax, %rbx
jmp 0x8fda
jmp 0x8f85
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x8f8d
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x2230
jmp 0x8f8d
movq %rax, %rbx
jmp 0x8fb2
movq %rax, %rbx
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x8fb2
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x60(%rsp), %rdi
callq 0x900c
jmp 0x8fc3
jmp 0x8fc0
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8fda
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2230
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x8ff6
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0xe8(%rsp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x2400
nop