// File: /workspace/github_cpp_makefile_star2_O1/superyuan[P]refeditor/CLineFields1.cpp
// Function: GenomeLib::toRef(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
GenomePosition GenomeLib::toRef(string name, string position, bool removeb)
{
	GenomePosition gp;
	gp.pos = atoi(position.c_str());
	gp.strand = 1;
	if (gp.pos < 0) {
		gp.pos = -gp.pos;
		gp.strand = -1;
	}
	gp.chrName = name;
	size_t found = gp.chrName.find('.');
	if (found != string::npos) {
		// it is a stripped diploid chromosome
		gp.pos += atoi(gp.chrName.substr(found+1).c_str()) -1;
		gp.chrName = gp.chrName.substr(0, found);
	}
	if (removeb) {
		char last_char=gp.chrName[gp.chrName.length()-1];
		if ((last_char>='0' && last_char<='9')||(last_char>='A' && last_char<='Z')||(gp.chrName=="*")) {
			// read is on reference allele
			gp.allele = 0;
		} else {
			// read is on alternative allele
			gp.allele = gp.chrName[gp.chrName.length()-1]-'a';
			gp.chrName = gp.chrName.substr(0,gp.chrName.length()-1);
		}
		//		if (gp.chrName.length()>MAX_CHR_NAME_LEN) {
		//convert mini chromosome coordinates to normal coordinates
		//			gp.chrName = gp.chrName.substr(0,gp.chrName.length()-3);
		//		}
		//found = gp.chrName.find('b');// remove all 'b' in the chr name
		//while (found != string::npos){
		//	gp.chrName.replace(found,1,"");
		//	found = gp.chrName.find('b');
		//}
	}
	return gp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %r12
movq %r12, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movq (%rdx), %rdi
callq 0x3320
movl %eax, 0x20(%rbx)
movl $0x1, 0x28(%rbx)
testl %eax, %eax
jns 0x5c7b
negl %eax
movl %eax, 0x20(%rbx)
movl $0xffffffff, 0x28(%rbx) # imm = 0xFFFFFFFF
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3130
movq %rbx, %rdi
movl $0x2e, %esi
xorl %edx, %edx
callq 0x32c0
cmpq $-0x1, %rax
je 0x5d21
movq %rax, %r14
leaq 0x1(%rax), %rdx
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq $-0x1, %rcx
callq 0x3250
leaq 0x18(%rsp), %r13
movq -0x10(%r13), %r15
movq %r15, %rdi
callq 0x3320
movl 0x20(%rbx), %ecx
addl %ecx, %eax
decl %eax
movl %eax, 0x20(%rbx)
cmpq %r13, %r15
je 0x5cea
movq 0x18(%rsp), %rsi
incq %rsi
movq %r15, %rdi
callq 0x3240
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0x3250
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32a0
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x5d21
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3240
testb %bpl, %bpl
je 0x5db3
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movb -0x1(%rax,%rcx), %al
leal -0x30(%rax), %ecx
cmpb $0xa, %cl
setb %cl
addb $-0x41, %al
cmpb $0x1a, %al
setb %al
orb %cl, %al
jne 0x5dac
leaq 0x1649(%rip), %rsi      # 0x7399
movq %rbx, %rdi
callq 0x30b0
testl %eax, %eax
je 0x5dac
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movsbl -0x1(%rax,%rcx), %eax
decq %rcx
addl $-0x61, %eax
movl %eax, 0x24(%rbx)
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3250
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32a0
movq (%r14), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5db3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3240
jmp 0x5db3
movl $0x0, 0x24(%rbx)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5dcb
jmp 0x5dcb
jmp 0x5dcb
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x5de2
movq (%r12), %rsi
incq %rsi
callq 0x3240
movq %r14, %rdi
callq 0x33a0