// File: tonymugen[P]sampleSNPs/populations.cpp
// Function: sampFiles::PopIndex::PopIndex(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
PopIndex::PopIndex(const string &inFileName){
	ifstream idxFl(inFileName.c_str());
	
	if (!idxFl) {
		cerr << "ERROR: cannot open file " << inFileName << endl;
		exit(1);
	}
	int tmpIn;
	_N = 0;
	while (idxFl >> tmpIn) {
		if (tmpIn < 0) {
			cerr << "ERROR: negative population IDs not allowed when initializing PopIndex" << endl;
			exit(1);
		}
		else if (tmpIn == 0) {
			cerr << "ERROR: population indexes should be base-1 when initializing PopIndex" << endl;
			exit(2);
		}
		if (tmpIn > _popInd.size()) {
			_popInd.resize(tmpIn); // maybe this popID is a few steps ahead of the current
			_popInd[tmpIn - 1].push_back(_N);
			_N++;
		}
		else {
			_popInd[tmpIn - 1].push_back(_N);
			_N++;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x280, %rsp            # imm = 0x280
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x238(%rbp)
movq %rdi, %rax
movq %rax, -0x230(%rbp)
callq 0x20e20
movq -0x10(%rbp), %rdi
callq 0x4120
movq %rax, %rsi
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x45d0
jmp 0x20b8c
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x4160
movb %al, -0x239(%rbp)
jmp 0x20bac
movb -0x239(%rbp), %al
testb $0x1, %al
jne 0x20bbb
jmp 0x20c49
movq 0xc42e(%rip), %rdi      # 0x2cff0
leaq 0x3401(%rip), %rsi      # 0x23fca
callq 0x42f0
movq %rax, -0x248(%rbp)
jmp 0x20bd7
movq -0x248(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x42c0
movq %rax, -0x250(%rbp)
jmp 0x20bf0
movq -0x250(%rbp), %rdi
movq 0xc3b2(%rip), %rsi      # 0x2cfb0
callq 0x4320
jmp 0x20c05
movl $0x1, %edi
callq 0x43b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x20e03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x40d0
jmp 0x20e03
movq -0x230(%rbp), %rax
movq $0x0, 0x18(%rax)
leaq -0x218(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x41d0
movq %rax, -0x258(%rbp)
jmp 0x20c74
movq -0x258(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x43f0
movb %al, -0x259(%rbp)
jmp 0x20c92
movb -0x259(%rbp), %al
testb $0x1, %al
jne 0x20ca1
jmp 0x20dee
cmpl $0x0, -0x228(%rbp)
jge 0x20ce5
movq 0xc33f(%rip), %rdi      # 0x2cff0
leaq 0x332b(%rip), %rsi      # 0x23fe3
callq 0x42f0
movq %rax, -0x268(%rbp)
jmp 0x20cc6
movq -0x268(%rbp), %rdi
movq 0xc2dc(%rip), %rsi      # 0x2cfb0
callq 0x4320
jmp 0x20cdb
movl $0x1, %edi
callq 0x43b0
cmpl $0x0, -0x228(%rbp)
jne 0x20d29
movq 0xc2fb(%rip), %rdi      # 0x2cff0
leaq 0x332d(%rip), %rsi      # 0x24029
callq 0x42f0
movq %rax, -0x270(%rbp)
jmp 0x20d0a
movq -0x270(%rbp), %rdi
movq 0xc298(%rip), %rsi      # 0x2cfb0
callq 0x4320
jmp 0x20d1f
movl $0x2, %edi
callq 0x43b0
jmp 0x20d2b
movq -0x230(%rbp), %rdi
movslq -0x228(%rbp), %rax
movq %rax, -0x278(%rbp)
callq 0x1d1f0
movq %rax, %rcx
movq -0x278(%rbp), %rax
cmpq %rcx, %rax
jbe 0x20daa
movq -0x230(%rbp), %rdi
movslq -0x228(%rbp), %rsi
callq 0x20e40
jmp 0x20d69
movq -0x230(%rbp), %rdi
movl -0x228(%rbp), %eax
decl %eax
movslq %eax, %rsi
callq 0x20ed0
movq -0x230(%rbp), %rsi
movq %rax, %rdi
addq $0x18, %rsi
callq 0x20ef0
jmp 0x20d95
movq -0x230(%rbp), %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
jmp 0x20de9
movq -0x230(%rbp), %rdi
movl -0x228(%rbp), %eax
decl %eax
movslq %eax, %rsi
callq 0x20ed0
movq -0x230(%rbp), %rsi
movq %rax, %rdi
addq $0x18, %rsi
callq 0x20ef0
jmp 0x20dd6
movq -0x230(%rbp), %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
jmp 0x20c58
leaq -0x218(%rbp), %rdi
callq 0x40d0
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
movq -0x238(%rbp), %rdi
callq 0x58d0
movq -0x220(%rbp), %rdi
callq 0x45a0
nopl (%rax,%rax)