// File: tplinderoth[P]introDist/Dxyz.cpp
// Function: parseGenotype(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<int, std::allocator<int>>&)
std::vector<int>::iterator& parseGenotype (const std::string &gt, std::vector<int> &alleles) {
	// sets the alleles in the allele vector and advances the iterator to the last set position
	static std::vector<int>::iterator it = alleles.begin();

	if (gt[1] == '/' || gt[1] == '|') {
		for (unsigned int i=0; i<3; i+=2) {
			switch (gt[i]) {
				case '0':
					*it = 0;
					break;
				case '1':
					*it = 1;
					break;
				case '.':
					*it = -9;
					break;
				default:
					std::cerr << "Unrecognized allele " << gt[i] << "\n";
					it = alleles.end();
					return it;
			}
			++it;
		}
	} else {
		std::cerr << "Invalid genotype subfield format\n";
		it=alleles.end();
		return it;
	}

	if (it == alleles.end()) {
		it = alleles.begin();
	}

	return it;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpb $0x0, 0x22da1(%rip)     # 0x2d4f8
jne 0xa786
leaq 0x22d98(%rip), %rdi     # 0x2d4f8
callq 0x8880
cmpl $0x0, %eax
je 0xa786
movq -0x18(%rbp), %rdi
callq 0xbda0
movq %rax, 0x22d76(%rip)     # 0x2d4f0
leaq 0x22d77(%rip), %rdi     # 0x2d4f8
callq 0x82c0
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x8480
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0xa7b6
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x8480
movsbl (%rax), %eax
cmpl $0x7c, %eax
jne 0xa8b9
movl $0x0, -0x1c(%rbp)
cmpl $0x3, -0x1c(%rbp)
jae 0xa8b7
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x8480
movsbl (%rax), %eax
movl %eax, -0x44(%rbp)
subl $0x2e, %eax
je 0xa821
jmp 0xa7e2
movl -0x44(%rbp), %eax
subl $0x30, %eax
je 0xa7f6
jmp 0xa7ec
movl -0x44(%rbp), %eax
subl $0x31, %eax
je 0xa80d
jmp 0xa835
leaq 0x22cf3(%rip), %rdi     # 0x2d4f0
callq 0xbdd0
movl $0x0, (%rax)
jmp 0xa89d
leaq 0x22cdc(%rip), %rdi     # 0x2d4f0
callq 0xbdd0
movl $0x1, (%rax)
jmp 0xa89d
leaq 0x22cc8(%rip), %rdi     # 0x2d4f0
callq 0xbdd0
movl $0xfffffff7, (%rax)     # imm = 0xFFFFFFF7
jmp 0xa89d
movq 0x227ac(%rip), %rdi     # 0x2cfe8
leaq 0x13c80(%rip), %rsi     # 0x1e4c3
callq 0x8400
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x8480
movq -0x50(%rbp), %rdi
movsbl (%rax), %esi
callq 0x8510
movq %rax, %rdi
leaq 0x13813(%rip), %rsi     # 0x1e083
callq 0x8400
movq -0x18(%rbp), %rdi
callq 0xb7e0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, 0x22c63(%rip)     # 0x2d4f0
leaq 0x22c5c(%rip), %rax     # 0x2d4f0
movq %rax, -0x8(%rbp)
jmp 0xa937
leaq 0x22c4c(%rip), %rdi     # 0x2d4f0
callq 0xbdf0
movl -0x1c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa7bd
jmp 0xa8f1
movq 0x22728(%rip), %rdi     # 0x2cfe8
leaq 0x13c11(%rip), %rsi     # 0x1e4d8
callq 0x8400
movq -0x18(%rbp), %rdi
callq 0xb7e0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, 0x22c0c(%rip)     # 0x2d4f0
leaq 0x22c05(%rip), %rax     # 0x2d4f0
movq %rax, -0x8(%rbp)
jmp 0xa937
movq -0x18(%rbp), %rdi
callq 0xb7e0
movq %rax, -0x38(%rbp)
leaq 0x22beb(%rip), %rdi     # 0x2d4f0
leaq -0x38(%rbp), %rsi
callq 0xbae0
testb $0x1, %al
jne 0xa914
jmp 0xa92c
movq -0x18(%rbp), %rdi
callq 0xbda0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, 0x22bc4(%rip)     # 0x2d4f0
leaq 0x22bbd(%rip), %rax     # 0x2d4f0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)