// File: GenisGE[P]evalAdmix/filereader_and_conversions.cpp
// Function: to_int(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int to_int(std::string a){///@param a a String to convert.
  int str;
  float check;
  std::stringstream ss;
  std::stringstream ss2;
  if(!a.compare("NA")||!a.compare("Na")||!a.compare("na")){
    return 0;
  }
  ss<<a;
  if(!(ss>>str)){
    printf("Error converting :\"%s\" will exit\n",a.c_str());
    exit(0);
  }

  //now check if numberis really an int
  ss2<<a;
  if(!(ss2>>check)){
    printf("Error converting :\"%s\" will exit\n",a.c_str());
    exit(0);
  }

  if(check!=str){
    printf("String you want as in integer is not really an integer: \"%s\"\n",a.c_str());
    puts("Just a warning");
  }
  //check values
  /* this was commented in v. 0.983 since the chromosome file converter uses it.
  if(str<0||str>3){
    printf("Value in genotype is out of bounds, should be {0...3} value is:%d\n",str);
    exit(0);
  }
  */
  return str;///@return Function returns the integer value.
}

// Assembly:
subq $0x368, %rsp            # imm = 0x368
movq %rdi, 0x28(%rsp)
movq %rdi, 0x358(%rsp)
leaq 0x1c8(%rsp), %rdi
callq 0x31a0
leaq 0x40(%rsp), %rdi
callq 0x31a0
jmp 0xa76d
movq 0x28(%rsp), %rdi
leaq 0xe867(%rip), %rsi      # 0x18fe0
callq 0x30b0
cmpl $0x0, %eax
je 0xa7af
movq 0x28(%rsp), %rdi
leaq 0xe854(%rip), %rsi      # 0x18fe3
callq 0x30b0
cmpl $0x0, %eax
je 0xa7af
movq 0x28(%rsp), %rdi
leaq 0xe841(%rip), %rsi      # 0x18fe6
callq 0x30b0
cmpl $0x0, %eax
jne 0xa7da
movl $0x0, 0x364(%rsp)
movl $0x1, 0x30(%rsp)
jmp 0xa93f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
jmp 0xa965
movq 0x28(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x3250
jmp 0xa7ee
leaq 0x1c8(%rsp), %rdi
leaq 0x354(%rsp), %rsi
callq 0x3160
movq %rax, 0x20(%rsp)
jmp 0xa80a
movq 0x20(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3120
movb %al, 0x1f(%rsp)
jmp 0xa824
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0xa82e
jmp 0xa86f
movq 0x28(%rsp), %rdi
callq 0x30f0
movq %rax, %rsi
leaq 0xe7a7(%rip), %rdi      # 0x18fe9
xorl %eax, %eax
callq 0x3040
jmp 0xa84b
xorl %edi, %edi
callq 0x3340
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x31c0
jmp 0xa965
movq 0x28(%rsp), %rsi
leaq 0x50(%rsp), %rdi
callq 0x3250
jmp 0xa880
leaq 0x40(%rsp), %rdi
leaq 0x350(%rsp), %rsi
callq 0x3060
movq %rax, 0x10(%rsp)
jmp 0xa899
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3120
movb %al, 0xf(%rsp)
jmp 0xa8b3
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0xa8bd
jmp 0xa8e1
movq 0x28(%rsp), %rdi
callq 0x30f0
movq %rax, %rsi
leaq 0xe718(%rip), %rdi      # 0x18fe9
xorl %eax, %eax
callq 0x3040
jmp 0xa8da
xorl %edi, %edi
callq 0x3340
movss 0x350(%rsp), %xmm0
cvtsi2ssl 0x354(%rsp), %xmm1
ucomiss %xmm1, %xmm0
jne 0xa8fc
jp 0xa8fc
jmp 0xa929
movq 0x28(%rsp), %rdi
callq 0x30f0
movq %rax, %rsi
leaq 0xe6fb(%rip), %rdi      # 0x1900b
xorl %eax, %eax
callq 0x3040
jmp 0xa919
leaq 0xe729(%rip), %rdi      # 0x19049
callq 0x3440
jmp 0xa927
jmp 0xa929
movl 0x354(%rsp), %eax
movl %eax, 0x364(%rsp)
movl $0x1, 0x30(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x31c0
leaq 0x1c8(%rsp), %rdi
callq 0x31c0
movl 0x364(%rsp), %eax
addq $0x368, %rsp            # imm = 0x368
retq
leaq 0x1c8(%rsp), %rdi
callq 0x31c0
movq 0x38(%rsp), %rdi
callq 0x34f0
nopl (%rax)