// File: /workspace/github_c_makefile_star2_O0/waynebhayes[P]SAHap/src/InputReader.cpp
// Function: SAHap::WIFInputReader::readGroundTruth(std::basic_ifstream<char, std::char_traits<char>>&, SAHap::InputFile&)
void WIFInputReader::readGroundTruth(ifstream& file, InputFile& parsed) {
	// Obtain sorted list of sites covered
	vector<dnapos_t> sites;
	sites.reserve(parsed.index.size());
	for (const auto& kv : parsed.index) {
		sites.push_back(kv.first);
	}
	sort(sites.begin(), sites.end());
	parsed.sites = sites;

	string buf;
	vector<vector<int>> truth;
	truth.reserve(parsed.ploidy);

	while (!file.eof()) {
		getline(file, buf);
		if (buf.size() == 0) continue;
		vector<int> ch(parsed.index.size(), -1);
		for (size_t i = 0; i < buf.size(); ++i) {
			char allele = buf[i];
			dnapos_t pos = sites[i];
			dnapos_t matrixPos = parsed.index[pos];
			if (allele == 'X') ch[matrixPos] = -1;
			else ch[matrixPos] = allele - '0';
			// else throw "Invalid ground truth allele value";
		}
		truth.push_back(ch);
	}

	if (truth.size() != parsed.ploidy) {
		cerr << "Warning: Number of haplotypes in ground truth does not match ploidy! Results will be meaningless." << endl;
	}

	parsed.groundTruth = truth;
	parsed.hasGroundTruth = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x6440
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x58b0
movq -0xe8(%rbp), %rdi
movq %rax, %rsi
callq 0x165d0
jmp 0x16011
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x166d0
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x16700
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x16730
testb $0x1, %al
jne 0x1604a
jmp 0x16084
leaq -0x48(%rbp), %rdi
callq 0x16760
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x16790
jmp 0x16066
jmp 0x16068
leaq -0x48(%rbp), %rdi
callq 0x16800
jmp 0x16037
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x163e7
leaq -0x28(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x8720
movq -0xf0(%rbp), %rdi
movq %rax, -0x60(%rbp)
callq 0x8750
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x16830
jmp 0x160b7
movq -0x10(%rbp), %rdi
addq $0x40, %rdi
leaq -0x28(%rbp), %rsi
callq 0x6a00
jmp 0x160ca
leaq -0x88(%rbp), %rdi
callq 0x2300
leaq -0xa0(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x64a0
movq -0xf8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x16870
jmp 0x160fe
jmp 0x16100
movq -0x8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2440
movb %al, -0xf9(%rbp)
jmp 0x1611b
movb -0xf9(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1612c
jmp 0x16339
movq -0x8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x2050
jmp 0x1613e
leaq -0x88(%rbp), %rdi
callq 0x2190
cmpq $0x0, %rax
jne 0x16163
jmp 0x16100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x163cf
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0x58b0
movq %rax, -0x110(%rbp)
movl $0xffffffff, -0xbc(%rbp) # imm = 0xFFFFFFFF
leaq -0xbd(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x60b0
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rcx
leaq -0xb8(%rbp), %rdi
leaq -0xbc(%rbp), %rdx
callq 0x11c00
jmp 0x161b7
leaq -0xbd(%rbp), %rdi
callq 0x6140
movq $0x0, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x2190
movq %rax, %rcx
movq -0x118(%rbp), %rax
cmpq %rcx, %rax
jae 0x16313
movq -0xc8(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x2480
movq %rax, -0x120(%rbp)
jmp 0x16217
movq -0x120(%rbp), %rax
movb (%rax), %al
movb %al, -0xc9(%rbp)
movq -0xc8(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x11df0
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
leaq -0xd8(%rbp), %rsi
callq 0x16970
movq %rax, -0x128(%rbp)
jmp 0x1625d
movq -0x128(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
movsbl -0xc9(%rbp), %eax
cmpl $0x58, %eax
jne 0x162cf
movq -0xe0(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x6160
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x162fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xbd(%rbp), %rdi
callq 0x6140
jmp 0x163cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x6220
jmp 0x163cf
movsbl -0xc9(%rbp), %eax
subl $0x30, %eax
movl %eax, -0x12c(%rbp)
movq -0xe0(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x6160
movl -0x12c(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x162fc
movq -0xc8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc8(%rbp)
jmp 0x161ce
leaq -0xa0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x169a0
jmp 0x16328
leaq -0xb8(%rbp), %rdi
callq 0x6220
jmp 0x16100
leaq -0xa0(%rbp), %rdi
callq 0xb650
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
je 0x16381
movq 0x14c9b(%rip), %rdi     # 0x2aff0
leaq 0x647f(%rip), %rsi      # 0x1c7db
callq 0x2230
movq %rax, -0x138(%rbp)
jmp 0x1636a
movq -0x138(%rbp), %rdi
movq 0x14c38(%rip), %rsi     # 0x2afb0
callq 0x2270
jmp 0x1637f
jmp 0x16381
movq -0x10(%rbp), %rdi
addq $0x88, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x70f0
jmp 0x1639a
movq -0x10(%rbp), %rax
movb $0x1, 0xb1(%rax)
leaq -0xa0(%rbp), %rdi
callq 0xd440
leaq -0x88(%rbp), %rdi
callq 0x2150
leaq -0x28(%rbp), %rdi
callq 0xd560
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
leaq -0xa0(%rbp), %rdi
callq 0xd440
leaq -0x88(%rbp), %rdi
callq 0x2150
leaq -0x28(%rbp), %rdi
callq 0xd560
movq -0x30(%rbp), %rdi
callq 0x2410
nopl (%rax)