// File: fhirschman[P]CANF-gp/source/general_functions.cc
// Function: load_params()
void load_params(){
	ifstream inFile;
	inFile.open("./PARAMS.dat");
	if (!inFile) {
	cerr << "Unable to open file PARAMS.dat";
   		exit(1);   // call system to stop
	}	
	string line;
	int line_index = 0;
	while (getline(inFile, line)) {
		if(line[0] == '#' || line[0] == ' '|| line.length() == 0 ){
			continue;
		}
		// Get number of word in line
		istringstream test_ss(line);
		string test_word;
		int N_words=-1;
		while(test_ss){
			test_ss >> test_word;
			N_words+=1;
		}

		istringstream ss(line); 
		string word;
		int word_counter=1;
		while(ss){  
			ss >> word;
			// Account for last two identical bits in sting stream
			if(word_counter==N_words){
				ss >> word;
			}
			switch (line_index) {
				case 0: {
					MODE=stoi(word);
					break;
				}
				case 1: {
					REP_MODE=stoi(word);
					break;
				}
				case 2:	{	
					POLY_N_TERMS= stoi(word);
					break; }
				case 3: {
					POLY_COEFFS.push_back(stof(word));
					break; }
				case 4: {
					POLY_EXPONS.push_back(stof(word));
					break; }
				case 5: {
					FRAC_DER_MODE = stoi(word);
					break; }	
				case 6: {
					ALPHA_FRAC_DER = stof(word);
					break; }
				case 7: {
					COLOR_CODE = stoi(word);
					break; }
				case 8: {
					ACCURACY = stof(word);
					break; }
				case 9: {
					N_ITER = stoi(word);
					break; }
				case 10: {
					N_X = stoi(word);
					break; }
				case 11: {
					N_Y = stoi(word);
					break; }
				case 12: {
					if(word_counter==1){
						START_X = stof(word);
					}
					if(word_counter==2){
						START_Y = stof(word);
					}
					break; }
				case 13: {
					if(word_counter==1){
						INTERVAL_LENGTH_X = stof(word);
					}
					if(word_counter==2){
						INTERVAL_LENGTH_Y = stof(word);
					}
					break; }
				case 14: {
					SAVE_DATA_FILE = stoi(word);
					break; }
				case 15: {
					BLOCK_SIZE = stoi(word);
					break; }
				case 16: {
					MAX_RANDOM_N_TERMS = stoi(word);
					break; }
				case 17: {
					RAND_EXPONENT_RANGE = stof(word);
					break; }
				case 18: {
					RAND_COEFF_RANGE = stof(word);
					break; }
				case 19: {
					if(word_counter==1){
						PROD_SERIES = stoi(word);
					}
					if(word_counter==2){
						AUTO_ZOOM = stoi(word);
					}
					if(word_counter==3){
						ALPHA_VAR = stoi(word);
					}
					break; }
				case 20: {
					N_FRAMES_SERIES = stoi(word);
					break; }
				case 21: {
					if(word_counter==1){
						LOWER_ALPHA = stof(word);
					}
					if(word_counter==2){
						UPPER_ALPHA = stof(word);
					}
					break; }
				case 22: {
					ZOOM_FAC = stof(word);
					break; }
			}
			word_counter+=1;
		}
		line_index+=1;
	}
	if(MODE==1){
		POLY_N_TERMS=MAX_RANDOM_N_TERMS;
	}
	return;
}

// Assembly:
subq $0x658, %rsp            # imm = 0x658
leaq 0x450(%rsp), %rdi
movq %rdi, 0xb0(%rsp)
callq 0x8610
movq 0xb0(%rsp), %rdi
leaq 0x144d9(%rip), %rsi     # 0x1e284
movl $0x8, %edx
callq 0x8340
jmp 0x9db7
movq 0x450(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x450(%rsp,%rax), %rdi
callq 0x8260
movb %al, 0xaf(%rsp)
jmp 0x9dd9
movb 0xaf(%rsp), %al
testb $0x1, %al
jne 0x9de6
jmp 0x9e1e
movq 0x1f1fb(%rip), %rdi     # 0x28fe8
leaq 0x1449d(%rip), %rsi     # 0x1e291
callq 0x84e0
jmp 0x9dfb
movl $0x1, %edi
callq 0x8670
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x448(%rsp)
movl %eax, 0x444(%rsp)
jmp 0xa74d
leaq 0x420(%rsp), %rdi
callq 0x8770
movl $0x0, 0x41c(%rsp)
leaq 0x450(%rsp), %rdi
leaq 0x420(%rsp), %rsi
callq 0x80b0
movq %rax, 0xa0(%rsp)
jmp 0x9e55
movq 0xa0(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x86b0
movb %al, 0x9f(%rsp)
jmp 0x9e75
movb 0x9f(%rsp), %al
testb $0x1, %al
jne 0x9e85
jmp 0xa700
xorl %eax, %eax
movl %eax, %esi
leaq 0x420(%rsp), %rdi
callq 0x8a80
movq %rax, 0x90(%rsp)
jmp 0x9ea0
movq 0x90(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
je 0x9eee
xorl %eax, %eax
movl %eax, %esi
leaq 0x420(%rsp), %rdi
callq 0x8a80
movq %rax, 0x88(%rsp)
jmp 0x9ecb
movq 0x88(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
je 0x9eee
leaq 0x420(%rsp), %rdi
callq 0x8840
cmpq $0x0, %rax
jne 0x9f0c
jmp 0x9e36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x448(%rsp)
movl %eax, 0x444(%rsp)
jmp 0xa740
leaq 0x298(%rsp), %rdi
leaq 0x420(%rsp), %rsi
movl $0x8, %edx
callq 0x88e0
jmp 0x9f28
leaq 0x278(%rsp), %rdi
callq 0x8770
movl $0xffffffff, 0x274(%rsp) # imm = 0xFFFFFFFF
movq 0x298(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x298(%rsp,%rax), %rdi
callq 0x86b0
movb %al, 0x87(%rsp)
jmp 0x9f62
movb 0x87(%rsp), %al
testb $0x1, %al
jne 0x9f6f
jmp 0x9fb2
leaq 0x298(%rsp), %rdi
leaq 0x278(%rsp), %rsi
callq 0x86d0
jmp 0x9f86
movl 0x274(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x274(%rsp)
jmp 0x9f40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x448(%rsp)
movl %eax, 0x444(%rsp)
jmp 0xa6e4
leaq 0xf0(%rsp), %rdi
leaq 0x420(%rsp), %rsi
movl $0x8, %edx
callq 0x88e0
jmp 0x9fce
leaq 0xd0(%rsp), %rdi
callq 0x8770
movl $0x1, 0xcc(%rsp)
movq 0xf0(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0xf0(%rsp,%rax), %rdi
callq 0x86b0
movb %al, 0x86(%rsp)
jmp 0xa008
movb 0x86(%rsp), %al
testb $0x1, %al
jne 0xa018
jmp 0xa69a
leaq 0xf0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x86d0
jmp 0xa02f
movl 0xcc(%rsp), %eax
cmpl 0x274(%rsp), %eax
jne 0xa08b
leaq 0xf0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x86d0
jmp 0xa056
jmp 0xa08b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x448(%rsp)
movl %eax, 0x444(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x8330
leaq 0xf0(%rsp), %rdi
callq 0x8270
jmp 0xa6e4
movl 0x41c(%rsp), %eax
movq %rax, 0x78(%rsp)
subq $0x16, %rax
ja 0xa684
movq 0x78(%rsp), %rax
leaq 0x13f93(%rip), %rcx     # 0x1e040
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x74(%rsp)
jmp 0xa0d2
movl 0x74(%rsp), %ecx
leaq 0x1f833(%rip), %rax     # 0x29910
movl %ecx, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x70(%rsp)
jmp 0xa100
movl 0x70(%rsp), %ecx
leaq 0x1f809(%rip), %rax     # 0x29914
movl %ecx, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x6c(%rsp)
jmp 0xa12e
movl 0x6c(%rsp), %ecx
leaq 0x1f7a3(%rip), %rax     # 0x298dc
movl %ecx, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0x68(%rsp)
jmp 0xa159
movss 0x68(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0xc0(%rsp)
leaq 0x1f865(%rip), %rdi     # 0x299d8
leaq 0xc0(%rsp), %rsi
callq 0xbf00
jmp 0xa182
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0x64(%rsp)
jmp 0xa1a0
movss 0x64(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0xb8(%rsp)
leaq 0x1f836(%rip), %rdi     # 0x299f0
leaq 0xb8(%rsp), %rsi
callq 0xbf00
jmp 0xa1c9
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x60(%rsp)
jmp 0xa1ea
movl 0x60(%rsp), %ecx
leaq 0x1f713(%rip), %rax     # 0x29908
movl %ecx, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0x5c(%rsp)
jmp 0xa215
movss 0x5c(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1f7aa(%rip), %rax     # 0x299d0
movsd %xmm0, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x58(%rsp)
jmp 0xa24b
movl 0x58(%rsp), %ecx
leaq 0x1f6ae(%rip), %rax     # 0x29904
movl %ecx, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0x54(%rsp)
jmp 0xa276
movss 0x54(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1f6f1(%rip), %rax     # 0x29978
movsd %xmm0, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x50(%rsp)
jmp 0xa2ac
movl 0x50(%rsp), %ecx
leaq 0x1f629(%rip), %rax     # 0x298e0
movl %ecx, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x4c(%rsp)
jmp 0xa2da
movl 0x4c(%rsp), %ecx
leaq 0x1f5ff(%rip), %rax     # 0x298e4
movl %ecx, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x48(%rsp)
jmp 0xa308
movl 0x48(%rsp), %ecx
leaq 0x1f5d5(%rip), %rax     # 0x298e8
movl %ecx, (%rax)
jmp 0xa684
cmpl $0x1, 0xcc(%rsp)
jne 0xa352
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0x44(%rsp)
jmp 0xa33d
movss 0x44(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1f5ca(%rip), %rax     # 0x29918
movsd %xmm0, (%rax)
cmpl $0x2, 0xcc(%rsp)
jne 0xa38a
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0x40(%rsp)
jmp 0xa375
movss 0x40(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1f59a(%rip), %rax     # 0x29920
movsd %xmm0, (%rax)
jmp 0xa684
cmpl $0x1, 0xcc(%rsp)
jne 0xa3c7
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0x3c(%rsp)
jmp 0xa3b2
movss 0x3c(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1f5d5(%rip), %rax     # 0x29998
movsd %xmm0, (%rax)
cmpl $0x2, 0xcc(%rsp)
jne 0xa3ff
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0x38(%rsp)
jmp 0xa3ea
movss 0x38(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1f5a5(%rip), %rax     # 0x299a0
movsd %xmm0, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x34(%rsp)
jmp 0xa420
movl 0x34(%rsp), %eax
cmpl $0x0, %eax
setne %cl
andb $0x1, %cl
leaq 0x1f54d(%rip), %rax     # 0x29981
movb %cl, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x30(%rsp)
jmp 0xa457
movl 0x30(%rsp), %ecx
leaq 0x1f48a(%rip), %rax     # 0x298ec
movl %ecx, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x2c(%rsp)
jmp 0xa485
movl 0x2c(%rsp), %ecx
leaq 0x1f460(%rip), %rax     # 0x298f0
movl %ecx, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0x28(%rsp)
jmp 0xa4b0
movss 0x28(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1f4e7(%rip), %rax     # 0x299a8
movsd %xmm0, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0x24(%rsp)
jmp 0xa4e3
movss 0x24(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1f4bc(%rip), %rax     # 0x299b0
movsd %xmm0, (%rax)
jmp 0xa684
cmpl $0x1, 0xcc(%rsp)
jne 0xa539
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x20(%rsp)
jmp 0xa523
movl 0x20(%rsp), %eax
cmpl $0x0, %eax
setne %cl
andb $0x1, %cl
leaq 0x1f44d(%rip), %rax     # 0x29984
movb %cl, (%rax)
cmpl $0x2, 0xcc(%rsp)
jne 0xa575
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x1c(%rsp)
jmp 0xa55f
movl 0x1c(%rsp), %eax
cmpl $0x0, %eax
setne %cl
andb $0x1, %cl
leaq 0x1f412(%rip), %rax     # 0x29985
movb %cl, (%rax)
cmpl $0x3, 0xcc(%rsp)
jne 0xa5b1
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x18(%rsp)
jmp 0xa59b
movl 0x18(%rsp), %eax
cmpl $0x0, %eax
setne %cl
andb $0x1, %cl
leaq 0x1f3d7(%rip), %rax     # 0x29986
movb %cl, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
movl $0xa, %edx
callq 0xbeb0
movl %eax, 0x14(%rsp)
jmp 0xa5d2
movl 0x14(%rsp), %ecx
leaq 0x1f32f(%rip), %rax     # 0x2990c
movl %ecx, (%rax)
jmp 0xa684
cmpl $0x1, 0xcc(%rsp)
jne 0xa61c
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0x10(%rsp)
jmp 0xa607
movss 0x10(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1f310(%rip), %rax     # 0x29928
movsd %xmm0, (%rax)
cmpl $0x2, 0xcc(%rsp)
jne 0xa654
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0xc(%rsp)
jmp 0xa63f
movss 0xc(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1f2e0(%rip), %rax     # 0x29930
movsd %xmm0, (%rax)
jmp 0xa684
xorl %eax, %eax
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0xbf30
movss %xmm0, 0x8(%rsp)
jmp 0xa66f
movss 0x8(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1f310(%rip), %rax     # 0x29990
movsd %xmm0, (%rax)
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
jmp 0x9fe6
movl 0x41c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x41c(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x8330
leaq 0xf0(%rsp), %rdi
callq 0x8270
leaq 0x278(%rsp), %rdi
callq 0x8330
leaq 0x298(%rsp), %rdi
callq 0x8270
jmp 0x9e36
leaq 0x278(%rsp), %rdi
callq 0x8330
leaq 0x298(%rsp), %rdi
callq 0x8270
jmp 0xa740
leaq 0x1f209(%rip), %rax     # 0x29910
cmpl $0x1, (%rax)
jne 0xa71e
leaq 0x1f1dd(%rip), %rax     # 0x298f0
movl (%rax), %ecx
leaq 0x1f1c0(%rip), %rax     # 0x298dc
movl %ecx, (%rax)
leaq 0x420(%rsp), %rdi
callq 0x8330
leaq 0x450(%rsp), %rdi
callq 0x80f0
addq $0x658, %rsp            # imm = 0x658
retq
leaq 0x420(%rsp), %rdi
callq 0x8330
leaq 0x450(%rsp), %rdi
callq 0x80f0
movq 0x448(%rsp), %rdi
callq 0x8960
nopw (%rax,%rax)