// File: CK7[P]abawaca/src/ClusterData.cpp
// Function: ClusterData::ClusterData(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, ScafDpData const&)
ClusterData::ClusterData(string esom_lrn_file, const ScafDpData& scaf_db)
{
        FILE* fp = fopen(esom_lrn_file.c_str(), "r");

        if(!fp) {
                cerr << __FILE__ << " (" << __LINE__ << "): Fatal error: could not read " << esom_lrn_file << endl << endl;
                exit(-1);
        }

        char line[8192] = {};

	/********** Read # of dps **********/
	// % 8430
        if(!fgets(line, 8192, fp)) {
                cerr << __FILE__ << " (" << __LINE__ << "): Fatal error: " << esom_lrn_file << " is empty" << endl << endl;
                exit(-1);
        }

        // % 8430
        unsigned int ndps;
        char    c;
        if((sscanf(line, "%c %u", &c, &ndps) != 2) || (c != '%')) {
                cerr << __FILE__ << " (" << __LINE__ << "): Fatal error: unexpected line 1 in " << esom_lrn_file << ": " << endl << line << endl << endl;
                exit(-1);
        }

	/********** Read # of dimensions **********/
	// % 12
        if(!fgets(line, 8192, fp)) {
                cerr << __FILE__ << " (" << __LINE__ << "): Fatal error: failed to read line 2 in " << esom_lrn_file << endl << endl;
                exit(-1);
        }

        unsigned int ndimensions;
        if((sscanf(line, "%c %u", &c, &ndimensions) != 2) || (c != '%')) {
                cerr << __FILE__ << " (" << __LINE__ << "): Fatal error: unexpected line 2 in " << esom_lrn_file << ": " << endl << line << endl << endl;
                exit(-1);
        }
	ndimensions--;		// Count in the file contains the dp column

	/********** Read weights for dimensions. We don't use it but just verify that the number found is right **********/
	// % 9	1	1	1	1	1	1	1	1	1	1	1
        if(!fgets(line, 8192, fp)) {
                cerr << __FILE__ << " (" << __LINE__ << "): Fatal error: failed to read line 3 in " << esom_lrn_file << endl << endl;
                exit(-1);
        }

        unsigned int t = 1;
	while(strrchr(line, '\t') != NULL) {
		t++;
		*strrchr(line, '\t') = 0;
	}
        if(t != (ndimensions+1)) {
                cerr << __FILE__ << " (" << __LINE__ << "): Fatal error: unexpected line 3 in " << esom_lrn_file << ": number of fileds is differemt that " << ndimensions << endl << line << endl << endl;
                exit(-1);
        }

	/********** Read dimension names **********/
	// % key	74-1	74-10	74-11	74-12	74-2	74-3	74-4	74-5	74-6	74-7	74-9
        if(!fgets(line, 8192, fp)) {
                cerr << __FILE__ << " (" << __LINE__ << "): Fatal error: failed to read line 4 in " << esom_lrn_file << endl << endl;
                exit(-1);
        }

	// Chomp
	while((strlen(line)>0) && isspace(*(line+strlen(line)-1)))
		*(line+strlen(line)-1) = 0;

	dimensions.push_back(NULL);
	// We skip the first column which contains the dp title
	char *p1=strchr(line, '\t')+1, *p2=strchr(p1, '\t');
	size_t	i = 1;
	while(p2) {
		*p2 = 0;
		dimensions.push_back(new Dimension(i++, string(p1)));
		p1 = p2+1;
		p2=strchr(p1, '\t');
	}
	// Last dimension is not accompanied by a tab
	dimensions.push_back(new Dimension(i, string(p1)));

	if(i != ndimensions) {
                cerr << __FILE__ << " (" << __LINE__ << "): Fatal error: number of dimensions found in line 4 (" << i << ") is different than expected (" << ndimensions << ") in file " << esom_lrn_file << ":" << endl << line << endl << endl;
                exit(-1);
	}

	/********** And finally, read the values themselves **********/	
	size_t entry=0;
	map<size_t, string>	data;

	while(fgets(line, 8192, fp)) {
		// Chomp
		while((strlen(line)>0) && isspace(*(line+strlen(line)-1)))
			*(line+strlen(line)-1) = 0;

		// Skip empty or comment lines
		if((line[0] == '%') || (strlen(line) == 0))
			continue;

		// The following means that we have more lines than expected by the % dps information
		if(entry >= ndps) {
			cerr << __FILE__ << " (" << __LINE__ << "): Fatal error: number of datapoint lines found is higher than expected (" << ndps << "), file " << esom_lrn_file << endl << endl;
			exit(-1);
		}

		char *p1, *p2;
		size_t t=1;
		// Count the number of values and make sure it's what we would expect
		for(p1=line, p2=strchr(p1, '\t'); p2!=NULL; p1=p2+1, p2=strchr(p1, '\t'))
			t++;
		if(t != (ndimensions+1)) {
			cerr << __FILE__ << " (" << __LINE__ << "): Fatal error: number of dimensions found is " << t << ", expected to find " << ndimensions << ": " << line << endl << endl; 
			exit(-1);
		}

		// 1	0.181737916437441	0	0.00990659188488923	0.551726686306843	0.0250488966425045	0.0706148967876072	0	0	0.00324475022645163	0.0147897529305731	0.142930508783691
		p1=line;
		p2=strchr(p1, '\t');
		*p2=0;
		int dp = scaf_db.dp_name2id(atoi(p1));

		if(dp != 0) {
			data.insert(pair<size_t, string>(dp, string(p2+1)));
		}
		entry++;
	}

	for(auto it=data.begin(); it!=data.end(); it++) {
		size_t dp = it->first;
		dps.insert(dp);
		int p1, p2, t;
		for(t=1, p1=0, p2=it->second.find('\t', 0); p2!=string::npos; t++, p1=p2+1, p2=p2=it->second.find('\t', p1)) {
			dimensions[t]->insert(dp, atof(it->second.substr(p1, p2-p1).c_str()));
		}
		// Last value
		dimensions[t]->insert(dp, atof(it->second.substr(p1).c_str()));
	}
	if(entry != ndps) {
		cerr << __FILE__ << " (" << __LINE__ << "): Fatal error: number of datapoint lines found (" << entry << ") is different than expected (" << ndps << "), file " << esom_lrn_file << endl << endl;
		exit(-1);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2630, %rsp           # imm = 0x2630
movq %rsi, -0x2208(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x2218(%rbp)
movq %rdi, %rax
movq %rax, -0x2220(%rbp)
callq 0x205a0
movq -0x2218(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0x2210(%rbp)
callq 0xbde0
movq -0x2208(%rbp), %rdi
callq 0x5190
movq %rax, %rdi
leaq 0x16538(%rip), %rsi     # 0x3514d
callq 0x54b0
movq %rax, -0x2200(%rbp)
jmp 0x1ec23
movq -0x2200(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x1ed0f
movq 0x2e3a8(%rip), %rdi     # 0x4cfe8
leaq 0x1714f(%rip), %rsi     # 0x35d96
callq 0x53f0
movq %rax, -0x2228(%rbp)
jmp 0x1ec55
movq -0x2228(%rbp), %rdi
leaq 0x172c2(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x2230(%rbp)
jmp 0x1ec71
movq -0x2230(%rbp), %rdi
movl $0x20, %esi
callq 0x5710
movq %rax, -0x2238(%rbp)
jmp 0x1ec8b
movq -0x2238(%rbp), %rdi
leaq 0x17111(%rip), %rsi     # 0x35daa
callq 0x53f0
movq %rax, -0x2240(%rbp)
jmp 0x1eca7
movq -0x2208(%rbp), %rsi
movq -0x2240(%rbp), %rdi
callq 0x5360
movq %rax, -0x2248(%rbp)
jmp 0x1ecc3
movq -0x2248(%rbp), %rdi
movq 0x2e2bf(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x2250(%rbp)
jmp 0x1ecdf
movq -0x2250(%rbp), %rdi
movq 0x2e2a3(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x1ecf4
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x54f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x203bb
leaq -0x2030(%rbp), %rdi
movq %rdi, -0x2260(%rbp)
xorl %esi, %esi
movl $0x2000, %edx           # imm = 0x2000
callq 0x5210
movq -0x2260(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x2000, %esi           # imm = 0x2000
callq 0x5690
movq %rax, -0x2258(%rbp)
jmp 0x1ed47
movq -0x2258(%rbp), %rax
cmpq $0x0, %rax
jne 0x1ee39
movq 0x2e289(%rip), %rdi     # 0x4cfe8
leaq 0x17030(%rip), %rsi     # 0x35d96
callq 0x53f0
movq %rax, -0x2268(%rbp)
jmp 0x1ed74
movq -0x2268(%rbp), %rdi
leaq 0x171a3(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x2270(%rbp)
jmp 0x1ed90
movq -0x2270(%rbp), %rdi
movl $0x29, %esi
callq 0x5710
movq %rax, -0x2278(%rbp)
jmp 0x1edaa
movq -0x2278(%rbp), %rdi
leaq 0x17012(%rip), %rsi     # 0x35dca
callq 0x53f0
movq %rax, -0x2280(%rbp)
jmp 0x1edc6
movq -0x2208(%rbp), %rsi
movq -0x2280(%rbp), %rdi
callq 0x5360
movq %rax, -0x2288(%rbp)
jmp 0x1ede2
movq -0x2288(%rbp), %rdi
leaq 0x16a30(%rip), %rsi     # 0x35820
callq 0x53f0
movq %rax, -0x2290(%rbp)
jmp 0x1edfe
movq -0x2290(%rbp), %rdi
movq 0x2e184(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x2298(%rbp)
jmp 0x1ee1a
movq -0x2298(%rbp), %rdi
movq 0x2e168(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x1ee2f
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x54f0
leaq -0x2030(%rbp), %rdi
leaq 0x169e3(%rip), %rsi     # 0x3582a
leaq -0x2035(%rbp), %rdx
leaq -0x2034(%rbp), %rcx
movb $0x0, %al
callq 0x53e0
cmpl $0x2, %eax
jne 0x1ee71
movsbl -0x2035(%rbp), %eax
cmpl $0x25, %eax
je 0x1ef8a
movq 0x2e170(%rip), %rdi     # 0x4cfe8
leaq 0x16f17(%rip), %rsi     # 0x35d96
callq 0x53f0
movq %rax, -0x22a0(%rbp)
jmp 0x1ee8d
movq -0x22a0(%rbp), %rdi
leaq 0x1708a(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x22a8(%rbp)
jmp 0x1eea9
movq -0x22a8(%rbp), %rdi
movl $0x31, %esi
callq 0x5710
movq %rax, -0x22b0(%rbp)
jmp 0x1eec3
movq -0x22b0(%rbp), %rdi
leaq 0x16f0a(%rip), %rsi     # 0x35ddb
callq 0x53f0
movq %rax, -0x22b8(%rbp)
jmp 0x1eedf
movq -0x2208(%rbp), %rsi
movq -0x22b8(%rbp), %rdi
callq 0x5360
movq %rax, -0x22c0(%rbp)
jmp 0x1eefb
movq -0x22c0(%rbp), %rdi
leaq 0x174da(%rip), %rsi     # 0x363e3
callq 0x53f0
movq %rax, -0x22c8(%rbp)
jmp 0x1ef17
movq -0x22c8(%rbp), %rdi
movq 0x2e06b(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x22d0(%rbp)
jmp 0x1ef33
movq -0x22d0(%rbp), %rdi
leaq -0x2030(%rbp), %rsi
callq 0x53f0
movq %rax, -0x22d8(%rbp)
jmp 0x1ef4f
movq -0x22d8(%rbp), %rdi
movq 0x2e033(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x22e0(%rbp)
jmp 0x1ef6b
movq -0x22e0(%rbp), %rdi
movq 0x2e017(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x1ef80
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x54f0
movq -0x20(%rbp), %rdx
leaq -0x2030(%rbp), %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x5690
movq %rax, -0x22e8(%rbp)
jmp 0x1efa8
movq -0x22e8(%rbp), %rax
cmpq $0x0, %rax
jne 0x1f07e
movq 0x2e028(%rip), %rdi     # 0x4cfe8
leaq 0x16dcf(%rip), %rsi     # 0x35d96
callq 0x53f0
movq %rax, -0x22f0(%rbp)
jmp 0x1efd5
movq -0x22f0(%rbp), %rdi
leaq 0x16f42(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x22f8(%rbp)
jmp 0x1eff1
movq -0x22f8(%rbp), %rdi
movl $0x38, %esi
callq 0x5710
movq %rax, -0x2300(%rbp)
jmp 0x1f00b
movq -0x2300(%rbp), %rdi
leaq 0x16de8(%rip), %rsi     # 0x35e01
callq 0x53f0
movq %rax, -0x2308(%rbp)
jmp 0x1f027
movq -0x2208(%rbp), %rsi
movq -0x2308(%rbp), %rdi
callq 0x5360
movq %rax, -0x2310(%rbp)
jmp 0x1f043
movq -0x2310(%rbp), %rdi
movq 0x2df3f(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x2318(%rbp)
jmp 0x1f05f
movq -0x2318(%rbp), %rdi
movq 0x2df23(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x1f074
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x54f0
leaq -0x2030(%rbp), %rdi
leaq 0x1679e(%rip), %rsi     # 0x3582a
leaq -0x2035(%rbp), %rdx
leaq -0x203c(%rbp), %rcx
movb $0x0, %al
callq 0x53e0
cmpl $0x2, %eax
jne 0x1f0b6
movsbl -0x2035(%rbp), %eax
cmpl $0x25, %eax
je 0x1f1cf
movq 0x2df2b(%rip), %rdi     # 0x4cfe8
leaq 0x16cd2(%rip), %rsi     # 0x35d96
callq 0x53f0
movq %rax, -0x2320(%rbp)
jmp 0x1f0d2
movq -0x2320(%rbp), %rdi
leaq 0x16e45(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x2328(%rbp)
jmp 0x1f0ee
movq -0x2328(%rbp), %rdi
movl $0x3e, %esi
callq 0x5710
movq %rax, -0x2330(%rbp)
jmp 0x1f108
movq -0x2330(%rbp), %rdi
leaq 0x16d15(%rip), %rsi     # 0x35e2b
callq 0x53f0
movq %rax, -0x2338(%rbp)
jmp 0x1f124
movq -0x2208(%rbp), %rsi
movq -0x2338(%rbp), %rdi
callq 0x5360
movq %rax, -0x2340(%rbp)
jmp 0x1f140
movq -0x2340(%rbp), %rdi
leaq 0x17295(%rip), %rsi     # 0x363e3
callq 0x53f0
movq %rax, -0x2348(%rbp)
jmp 0x1f15c
movq -0x2348(%rbp), %rdi
movq 0x2de26(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x2350(%rbp)
jmp 0x1f178
movq -0x2350(%rbp), %rdi
leaq -0x2030(%rbp), %rsi
callq 0x53f0
movq %rax, -0x2358(%rbp)
jmp 0x1f194
movq -0x2358(%rbp), %rdi
movq 0x2ddee(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x2360(%rbp)
jmp 0x1f1b0
movq -0x2360(%rbp), %rdi
movq 0x2ddd2(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x1f1c5
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x54f0
movl -0x203c(%rbp), %eax
decl %eax
movl %eax, -0x203c(%rbp)
movq -0x20(%rbp), %rdx
leaq -0x2030(%rbp), %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x5690
movq %rax, -0x2368(%rbp)
jmp 0x1f1fb
movq -0x2368(%rbp), %rax
cmpq $0x0, %rax
jne 0x1f2d1
movq 0x2ddd5(%rip), %rdi     # 0x4cfe8
leaq 0x16b7c(%rip), %rsi     # 0x35d96
callq 0x53f0
movq %rax, -0x2370(%rbp)
jmp 0x1f228
movq -0x2370(%rbp), %rdi
leaq 0x16cef(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x2378(%rbp)
jmp 0x1f244
movq -0x2378(%rbp), %rdi
movl $0x46, %esi
callq 0x5710
movq %rax, -0x2380(%rbp)
jmp 0x1f25e
movq -0x2380(%rbp), %rdi
leaq 0x16be5(%rip), %rsi     # 0x35e51
callq 0x53f0
movq %rax, -0x2388(%rbp)
jmp 0x1f27a
movq -0x2208(%rbp), %rsi
movq -0x2388(%rbp), %rdi
callq 0x5360
movq %rax, -0x2390(%rbp)
jmp 0x1f296
movq -0x2390(%rbp), %rdi
movq 0x2dcec(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x2398(%rbp)
jmp 0x1f2b2
movq -0x2398(%rbp), %rdi
movq 0x2dcd0(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x1f2c7
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x54f0
movl $0x1, -0x2040(%rbp)
leaq -0x2030(%rbp), %rdi
movl $0x9, %esi
callq 0x5470
cmpq $0x0, %rax
je 0x1f317
movl -0x2040(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2040(%rbp)
leaq -0x2030(%rbp), %rdi
movl $0x9, %esi
callq 0x5470
movb $0x0, (%rax)
jmp 0x1f2db
movl -0x2040(%rbp), %eax
movl -0x203c(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
je 0x1f462
movq 0x2dcb3(%rip), %rdi     # 0x4cfe8
leaq 0x16a5a(%rip), %rsi     # 0x35d96
callq 0x53f0
movq %rax, -0x23a0(%rbp)
jmp 0x1f34a
movq -0x23a0(%rbp), %rdi
leaq 0x16bcd(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x23a8(%rbp)
jmp 0x1f366
movq -0x23a8(%rbp), %rdi
movl $0x50, %esi
callq 0x5710
movq %rax, -0x23b0(%rbp)
jmp 0x1f380
movq -0x23b0(%rbp), %rdi
leaq 0x16aed(%rip), %rsi     # 0x35e7b
callq 0x53f0
movq %rax, -0x23b8(%rbp)
jmp 0x1f39c
movq -0x2208(%rbp), %rsi
movq -0x23b8(%rbp), %rdi
callq 0x5360
movq %rax, -0x23c0(%rbp)
jmp 0x1f3b8
movq -0x23c0(%rbp), %rdi
leaq 0x16adb(%rip), %rsi     # 0x35ea1
callq 0x53f0
movq %rax, -0x23c8(%rbp)
jmp 0x1f3d4
movq -0x23c8(%rbp), %rdi
movl -0x203c(%rbp), %esi
callq 0x5580
movq %rax, -0x23d0(%rbp)
jmp 0x1f3ef
movq -0x23d0(%rbp), %rdi
movq 0x2db93(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x23d8(%rbp)
jmp 0x1f40b
movq -0x23d8(%rbp), %rdi
leaq -0x2030(%rbp), %rsi
callq 0x53f0
movq %rax, -0x23e0(%rbp)
jmp 0x1f427
movq -0x23e0(%rbp), %rdi
movq 0x2db5b(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x23e8(%rbp)
jmp 0x1f443
movq -0x23e8(%rbp), %rdi
movq 0x2db3f(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x1f458
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x54f0
movq -0x20(%rbp), %rdx
leaq -0x2030(%rbp), %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x5690
movq %rax, -0x23f0(%rbp)
jmp 0x1f480
movq -0x23f0(%rbp), %rax
cmpq $0x0, %rax
jne 0x1f556
movq 0x2db50(%rip), %rdi     # 0x4cfe8
leaq 0x168f7(%rip), %rsi     # 0x35d96
callq 0x53f0
movq %rax, -0x23f8(%rbp)
jmp 0x1f4ad
movq -0x23f8(%rbp), %rdi
leaq 0x16a6a(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x2400(%rbp)
jmp 0x1f4c9
movq -0x2400(%rbp), %rdi
movl $0x57, %esi
callq 0x5710
movq %rax, -0x2408(%rbp)
jmp 0x1f4e3
movq -0x2408(%rbp), %rdi
leaq 0x169d6(%rip), %rsi     # 0x35ec7
callq 0x53f0
movq %rax, -0x2410(%rbp)
jmp 0x1f4ff
movq -0x2208(%rbp), %rsi
movq -0x2410(%rbp), %rdi
callq 0x5360
movq %rax, -0x2418(%rbp)
jmp 0x1f51b
movq -0x2418(%rbp), %rdi
movq 0x2da67(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x2420(%rbp)
jmp 0x1f537
movq -0x2420(%rbp), %rdi
movq 0x2da4b(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x1f54c
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x54f0
jmp 0x1f558
leaq -0x2030(%rbp), %rdi
callq 0x51b0
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x2421(%rbp)
jbe 0x1f59a
leaq -0x2030(%rbp), %rdi
callq 0x51b0
movsbl -0x2031(%rbp,%rax), %edi
callq 0x5090
cmpl $0x0, %eax
setne %al
movb %al, -0x2421(%rbp)
movb -0x2421(%rbp), %al
testb $0x1, %al
jne 0x1f5a6
jmp 0x1f5bc
leaq -0x2030(%rbp), %rdi
callq 0x51b0
movb $0x0, -0x2031(%rbp,%rax)
jmp 0x1f558
movq -0x2220(%rbp), %rdi
movq $0x0, -0x2048(%rbp)
leaq -0x2048(%rbp), %rsi
callq 0x205f0
jmp 0x1f5dc
leaq -0x2030(%rbp), %rdi
movl $0x9, %esi
callq 0x5170
addq $0x1, %rax
movq %rax, -0x2050(%rbp)
movq -0x2050(%rbp), %rdi
movl $0x9, %esi
callq 0x5170
movq %rax, -0x2058(%rbp)
movq $0x1, -0x2060(%rbp)
cmpq $0x0, -0x2058(%rbp)
je 0x1f78b
movq -0x2220(%rbp), %rax
movq -0x2058(%rbp), %rcx
movb $0x0, (%rcx)
movq %rax, -0x2438(%rbp)
movl $0xa0, %edi
callq 0x5410
movq %rax, -0x2430(%rbp)
jmp 0x1f654
movb $0x1, -0x208a(%rbp)
movq -0x2060(%rbp), %rax
movq %rax, -0x2450(%rbp)
incq %rax
movq %rax, -0x2060(%rbp)
movq -0x2050(%rbp), %rax
movq %rax, -0x2448(%rbp)
leaq -0x2089(%rbp), %rdi
movq %rdi, -0x2440(%rbp)
callq 0x5760
movq -0x2448(%rbp), %rsi
movq -0x2440(%rbp), %rdx
leaq -0x2088(%rbp), %rdi
callq 0x55b0
jmp 0x1f6b0
movq -0x2450(%rbp), %rsi
movq -0x2430(%rbp), %rdi
leaq -0x2088(%rbp), %rdx
callq 0x1cbe0
jmp 0x1f6cc
movq -0x2438(%rbp), %rdi
movq -0x2430(%rbp), %rax
movb $0x0, -0x208a(%rbp)
movq %rax, -0x2068(%rbp)
leaq -0x2068(%rbp), %rsi
callq 0x205f0
jmp 0x1f6f6
leaq -0x2088(%rbp), %rdi
callq 0x5250
leaq -0x2089(%rbp), %rdi
callq 0x5460
movq -0x2058(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2050(%rbp)
movq -0x2050(%rbp), %rdi
movl $0x9, %esi
callq 0x5170
movq %rax, -0x2058(%rbp)
jmp 0x1f61b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x1f763
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x2088(%rbp), %rdi
callq 0x5250
leaq -0x2089(%rbp), %rdi
callq 0x5460
testb $0x1, -0x208a(%rbp)
jne 0x1f77a
jmp 0x1f786
movq -0x2430(%rbp), %rdi
callq 0x53a0
jmp 0x203bb
movq -0x2220(%rbp), %rax
movq %rax, -0x2460(%rbp)
movl $0xa0, %edi
callq 0x5410
movq %rax, -0x2458(%rbp)
jmp 0x1f7ac
movb $0x1, -0x20ba(%rbp)
movq -0x2060(%rbp), %rax
movq %rax, -0x2478(%rbp)
movq -0x2050(%rbp), %rax
movq %rax, -0x2470(%rbp)
leaq -0x20b9(%rbp), %rdi
movq %rdi, -0x2468(%rbp)
callq 0x5760
movq -0x2470(%rbp), %rsi
movq -0x2468(%rbp), %rdx
leaq -0x20b8(%rbp), %rdi
callq 0x55b0
jmp 0x1f7fe
movq -0x2478(%rbp), %rsi
movq -0x2458(%rbp), %rdi
leaq -0x20b8(%rbp), %rdx
callq 0x1cbe0
jmp 0x1f81a
movq -0x2460(%rbp), %rdi
movq -0x2458(%rbp), %rax
movb $0x0, -0x20ba(%rbp)
movq %rax, -0x2098(%rbp)
leaq -0x2098(%rbp), %rsi
callq 0x205f0
jmp 0x1f844
leaq -0x20b8(%rbp), %rdi
callq 0x5250
leaq -0x20b9(%rbp), %rdi
callq 0x5460
movq -0x2060(%rbp), %rax
movl -0x203c(%rbp), %ecx
cmpq %rcx, %rax
je 0x1fa48
movq 0x2d76f(%rip), %rdi     # 0x4cfe8
leaq 0x16516(%rip), %rsi     # 0x35d96
callq 0x53f0
movq %rax, -0x2480(%rbp)
jmp 0x1f88e
movq -0x2480(%rbp), %rdi
leaq 0x16689(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x2488(%rbp)
jmp 0x1f8aa
movq -0x2488(%rbp), %rdi
movl $0x6d, %esi
callq 0x5710
movq %rax, -0x2490(%rbp)
jmp 0x1f8c4
movq -0x2490(%rbp), %rdi
leaq 0x1661f(%rip), %rsi     # 0x35ef1
callq 0x53f0
movq %rax, -0x2498(%rbp)
jmp 0x1f8e0
movq -0x2498(%rbp), %rdi
movq -0x2060(%rbp), %rsi
callq 0x50f0
movq %rax, -0x24a0(%rbp)
jmp 0x1f8fc
movq -0x24a0(%rbp), %rdi
leaq 0x1661e(%rip), %rsi     # 0x35f28
callq 0x53f0
movq %rax, -0x24a8(%rbp)
jmp 0x1f918
movq -0x24a8(%rbp), %rdi
movl -0x203c(%rbp), %esi
callq 0x5580
movq %rax, -0x24b0(%rbp)
jmp 0x1f933
movq -0x24b0(%rbp), %rdi
leaq 0x16606(%rip), %rsi     # 0x35f47
callq 0x53f0
movq %rax, -0x24b8(%rbp)
jmp 0x1f94f
movq -0x2208(%rbp), %rsi
movq -0x24b8(%rbp), %rdi
callq 0x5360
movq %rax, -0x24c0(%rbp)
jmp 0x1f96b
movq -0x24c0(%rbp), %rdi
leaq 0x15b3e(%rip), %rsi     # 0x354b7
callq 0x53f0
movq %rax, -0x24c8(%rbp)
jmp 0x1f987
movq -0x24c8(%rbp), %rdi
movq 0x2d5fb(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x24d0(%rbp)
jmp 0x1f9a3
movq -0x24d0(%rbp), %rdi
leaq -0x2030(%rbp), %rsi
callq 0x53f0
movq %rax, -0x24d8(%rbp)
jmp 0x1f9bf
movq -0x24d8(%rbp), %rdi
movq 0x2d5c3(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x24e0(%rbp)
jmp 0x1f9db
movq -0x24e0(%rbp), %rdi
movq 0x2d5a7(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x1f9f0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x54f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x1fa20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x20b8(%rbp), %rdi
callq 0x5250
leaq -0x20b9(%rbp), %rdi
callq 0x5460
testb $0x1, -0x20ba(%rbp)
jne 0x1fa37
jmp 0x1fa43
movq -0x2458(%rbp), %rdi
callq 0x53a0
jmp 0x203bb
movq $0x0, -0x20c8(%rbp)
leaq -0x20f8(%rbp), %rdi
callq 0x207f0
movq -0x20(%rbp), %rdx
leaq -0x2030(%rbp), %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x5690
movq %rax, -0x24e8(%rbp)
jmp 0x1fa7d
movq -0x24e8(%rbp), %rax
cmpq $0x0, %rax
je 0x1ffa1
jmp 0x1fa90
leaq -0x2030(%rbp), %rdi
callq 0x51b0
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x24e9(%rbp)
jbe 0x1fad2
leaq -0x2030(%rbp), %rdi
callq 0x51b0
movsbl -0x2031(%rbp,%rax), %edi
callq 0x5090
cmpl $0x0, %eax
setne %al
movb %al, -0x24e9(%rbp)
movb -0x24e9(%rbp), %al
testb $0x1, %al
jne 0x1fade
jmp 0x1fb05
leaq -0x2030(%rbp), %rdi
callq 0x51b0
movb $0x0, -0x2031(%rbp,%rax)
jmp 0x1fa90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x203af
movsbl -0x2030(%rbp), %eax
cmpl $0x25, %eax
je 0x1fb23
leaq -0x2030(%rbp), %rdi
callq 0x51b0
cmpq $0x0, %rax
jne 0x1fb28
jmp 0x1fa5f
movq -0x20c8(%rbp), %rax
movl -0x2034(%rbp), %ecx
cmpq %rcx, %rax
jb 0x1fc3a
movq 0x2d4a3(%rip), %rdi     # 0x4cfe8
leaq 0x1624a(%rip), %rsi     # 0x35d96
callq 0x53f0
movq %rax, -0x24f8(%rbp)
jmp 0x1fb5a
movq -0x24f8(%rbp), %rdi
leaq 0x163bd(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x2500(%rbp)
jmp 0x1fb76
movq -0x2500(%rbp), %rdi
movl $0x80, %esi
callq 0x5710
movq %rax, -0x2508(%rbp)
jmp 0x1fb90
movq -0x2508(%rbp), %rdi
leaq 0x163b4(%rip), %rsi     # 0x35f52
callq 0x53f0
movq %rax, -0x2510(%rbp)
jmp 0x1fbac
movq -0x2510(%rbp), %rdi
movl -0x2034(%rbp), %esi
callq 0x5580
movq %rax, -0x2518(%rbp)
jmp 0x1fbc7
movq -0x2518(%rbp), %rdi
leaq 0x163c7(%rip), %rsi     # 0x35f9c
callq 0x53f0
movq %rax, -0x2520(%rbp)
jmp 0x1fbe3
movq -0x2208(%rbp), %rsi
movq -0x2520(%rbp), %rdi
callq 0x5360
movq %rax, -0x2528(%rbp)
jmp 0x1fbff
movq -0x2528(%rbp), %rdi
movq 0x2d383(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x2530(%rbp)
jmp 0x1fc1b
movq -0x2530(%rbp), %rdi
movq 0x2d367(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x1fc30
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x54f0
movq $0x1, -0x2110(%rbp)
leaq -0x2030(%rbp), %rax
movq %rax, -0x2100(%rbp)
movq -0x2100(%rbp), %rdi
movl $0x9, %esi
callq 0x5170
movq %rax, -0x2108(%rbp)
cmpq $0x0, -0x2108(%rbp)
je 0x1fcb3
movq -0x2110(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2110(%rbp)
movq -0x2108(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2100(%rbp)
movq -0x2100(%rbp), %rdi
movl $0x9, %esi
callq 0x5170
movq %rax, -0x2108(%rbp)
jmp 0x1fc6b
movq -0x2110(%rbp), %rax
movl -0x203c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
je 0x1fe02
movq 0x2d313(%rip), %rdi     # 0x4cfe8
leaq 0x160ba(%rip), %rsi     # 0x35d96
callq 0x53f0
movq %rax, -0x2538(%rbp)
jmp 0x1fcea
movq -0x2538(%rbp), %rdi
leaq 0x1622d(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x2540(%rbp)
jmp 0x1fd06
movq -0x2540(%rbp), %rdi
movl $0x8a, %esi
callq 0x5710
movq %rax, -0x2548(%rbp)
jmp 0x1fd20
movq -0x2548(%rbp), %rdi
leaq 0x16277(%rip), %rsi     # 0x35fa5
callq 0x53f0
movq %rax, -0x2550(%rbp)
jmp 0x1fd3c
movq -0x2550(%rbp), %rdi
movq -0x2110(%rbp), %rsi
callq 0x50f0
movq %rax, -0x2558(%rbp)
jmp 0x1fd58
movq -0x2558(%rbp), %rdi
leaq 0x1626e(%rip), %rsi     # 0x35fd4
callq 0x53f0
movq %rax, -0x2560(%rbp)
jmp 0x1fd74
movq -0x2560(%rbp), %rdi
movl -0x203c(%rbp), %esi
callq 0x5580
movq %rax, -0x2568(%rbp)
jmp 0x1fd8f
movq -0x2568(%rbp), %rdi
leaq 0x16646(%rip), %rsi     # 0x363e3
callq 0x53f0
movq %rax, -0x2570(%rbp)
jmp 0x1fdab
movq -0x2570(%rbp), %rdi
leaq -0x2030(%rbp), %rsi
callq 0x53f0
movq %rax, -0x2578(%rbp)
jmp 0x1fdc7
movq -0x2578(%rbp), %rdi
movq 0x2d1bb(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x2580(%rbp)
jmp 0x1fde3
movq -0x2580(%rbp), %rdi
movq 0x2d19f(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x1fdf8
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x54f0
leaq -0x2030(%rbp), %rax
movq %rax, -0x2100(%rbp)
movq -0x2100(%rbp), %rdi
movl $0x9, %esi
callq 0x5170
movq %rax, -0x2108(%rbp)
movq -0x2108(%rbp), %rax
movb $0x0, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x2590(%rbp)
movq -0x2100(%rbp), %rdi
callq 0x5670
movq -0x2590(%rbp), %rdi
movslq %eax, %rsi
callq 0x20810
movq %rax, -0x2588(%rbp)
jmp 0x1fe61
movq -0x2588(%rbp), %rax
movl %eax, -0x2114(%rbp)
cmpl $0x0, -0x2114(%rbp)
je 0x1ff8a
movq -0x2108(%rbp), %rax
incq %rax
movq %rax, -0x25a0(%rbp)
leaq -0x2161(%rbp), %rdi
movq %rdi, -0x2598(%rbp)
callq 0x5760
movq -0x25a0(%rbp), %rsi
movq -0x2598(%rbp), %rdx
leaq -0x2160(%rbp), %rdi
callq 0x55b0
jmp 0x1febb
leaq -0x2140(%rbp), %rdi
leaq -0x2114(%rbp), %rsi
leaq -0x2160(%rbp), %rdx
callq 0x208d0
jmp 0x1fed7
leaq -0x20f8(%rbp), %rdi
leaq -0x2140(%rbp), %rsi
callq 0x20890
movb %dl, -0x25a9(%rbp)
movq %rax, -0x25a8(%rbp)
jmp 0x1fef9
movb -0x25a9(%rbp), %al
movq -0x25a8(%rbp), %rcx
movq %rcx, -0x2178(%rbp)
movb %al, -0x2170(%rbp)
leaq -0x2140(%rbp), %rdi
callq 0x20910
leaq -0x2160(%rbp), %rdi
callq 0x5250
leaq -0x2161(%rbp), %rdi
callq 0x5460
jmp 0x1ff8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x1ff79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x1ff6d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x2140(%rbp), %rdi
callq 0x20910
leaq -0x2160(%rbp), %rdi
callq 0x5250
leaq -0x2161(%rbp), %rdi
callq 0x5460
jmp 0x203af
movq -0x20c8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20c8(%rbp)
jmp 0x1fa5f
leaq -0x20f8(%rbp), %rdi
callq 0x20930
movq %rax, -0x2180(%rbp)
leaq -0x20f8(%rbp), %rdi
callq 0x20990
movq %rax, -0x2188(%rbp)
leaq -0x2180(%rbp), %rdi
leaq -0x2188(%rbp), %rsi
callq 0x20960
testb $0x1, %al
jne 0x1ffe3
jmp 0x20250
leaq -0x2180(%rbp), %rdi
callq 0x209c0
movq -0x2220(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x2190(%rbp)
addq $0x18, %rdi
leaq -0x2190(%rbp), %rsi
callq 0x209e0
movb %dl, -0x25b9(%rbp)
movq %rax, -0x25b8(%rbp)
jmp 0x2001f
movb -0x25b9(%rbp), %al
movq -0x25b8(%rbp), %rcx
movq %rcx, -0x21a0(%rbp)
movb %al, -0x2198(%rbp)
movl $0x1, -0x21ac(%rbp)
movl $0x0, -0x21a4(%rbp)
leaq -0x2180(%rbp), %rdi
callq 0x209c0
movq %rax, %rdi
addq $0x8, %rdi
movl $0x9, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x5560
movl %eax, -0x21a8(%rbp)
movslq -0x21a8(%rbp), %rax
cmpq $-0x1, %rax
je 0x2018a
movq -0x2220(%rbp), %rdi
movslq -0x21ac(%rbp), %rsi
callq 0x20a20
movq (%rax), %rax
movq %rax, -0x25d0(%rbp)
movq -0x2190(%rbp), %rax
movq %rax, -0x25c8(%rbp)
leaq -0x2180(%rbp), %rdi
callq 0x209c0
movq %rax, %rsi
addq $0x8, %rsi
movslq -0x21a4(%rbp), %rdx
movl %edx, %ecx
movl -0x21a8(%rbp), %eax
subl %ecx, %eax
movslq %eax, %rcx
leaq -0x21d0(%rbp), %rdi
callq 0x5420
jmp 0x200e5
leaq -0x21d0(%rbp), %rdi
callq 0x5190
movq %rax, %rdi
callq 0x5510
movq -0x25d0(%rbp), %rdi
movq -0x25c8(%rbp), %rsi
callq 0x1c930
jmp 0x2010e
leaq -0x21d0(%rbp), %rdi
callq 0x5250
movl -0x21ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x21ac(%rbp)
movl -0x21a8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x21a4(%rbp)
leaq -0x2180(%rbp), %rdi
callq 0x209c0
movq %rax, %rdi
addq $0x8, %rdi
movslq -0x21a4(%rbp), %rdx
movl $0x9, %esi
callq 0x5560
movl %eax, -0x21a8(%rbp)
movl %eax, -0x21a8(%rbp)
jmp 0x20074
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x21d0(%rbp), %rdi
callq 0x5250
jmp 0x203af
movq -0x2220(%rbp), %rdi
movslq -0x21ac(%rbp), %rsi
callq 0x20a20
movq (%rax), %rax
movq %rax, -0x25e0(%rbp)
movq -0x2190(%rbp), %rax
movq %rax, -0x25d8(%rbp)
leaq -0x2180(%rbp), %rdi
callq 0x209c0
movq %rax, %rsi
addq $0x8, %rsi
movslq -0x21a4(%rbp), %rdx
leaq -0x21f0(%rbp), %rdi
movq $-0x1, %rcx
callq 0x5420
jmp 0x201e4
leaq -0x21f0(%rbp), %rdi
callq 0x5190
movq %rax, %rdi
callq 0x5510
movq -0x25e0(%rbp), %rdi
movq -0x25d8(%rbp), %rsi
callq 0x1c930
jmp 0x2020d
leaq -0x21f0(%rbp), %rdi
callq 0x5250
leaq -0x2180(%rbp), %rdi
xorl %esi, %esi
callq 0x20a40
movq %rax, -0x21f8(%rbp)
jmp 0x1ffb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x21f0(%rbp), %rdi
callq 0x5250
jmp 0x203af
movq -0x20c8(%rbp), %rax
movl -0x2034(%rbp), %ecx
cmpq %rcx, %rax
je 0x2039a
movq 0x2cd7b(%rip), %rdi     # 0x4cfe8
leaq 0x15b22(%rip), %rsi     # 0x35d96
callq 0x53f0
movq %rax, -0x25e8(%rbp)
jmp 0x20282
movq -0x25e8(%rbp), %rdi
leaq 0x15c95(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x25f0(%rbp)
jmp 0x2029e
movq -0x25f0(%rbp), %rdi
movl $0xa5, %esi
callq 0x5710
movq %rax, -0x25f8(%rbp)
jmp 0x202b8
movq -0x25f8(%rbp), %rdi
leaq 0x15d22(%rip), %rsi     # 0x35fe8
callq 0x53f0
movq %rax, -0x2600(%rbp)
jmp 0x202d4
movq -0x2600(%rbp), %rdi
movq -0x20c8(%rbp), %rsi
callq 0x50f0
movq %rax, -0x2608(%rbp)
jmp 0x202f0
movq -0x2608(%rbp), %rdi
leaq 0x15c2a(%rip), %rsi     # 0x35f28
callq 0x53f0
movq %rax, -0x2610(%rbp)
jmp 0x2030c
movq -0x2610(%rbp), %rdi
movl -0x2034(%rbp), %esi
callq 0x5580
movq %rax, -0x2618(%rbp)
jmp 0x20327
movq -0x2618(%rbp), %rdi
leaq 0x15c67(%rip), %rsi     # 0x35f9c
callq 0x53f0
movq %rax, -0x2620(%rbp)
jmp 0x20343
movq -0x2208(%rbp), %rsi
movq -0x2620(%rbp), %rdi
callq 0x5360
movq %rax, -0x2628(%rbp)
jmp 0x2035f
movq -0x2628(%rbp), %rdi
movq 0x2cc23(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, -0x2630(%rbp)
jmp 0x2037b
movq -0x2630(%rbp), %rdi
movq 0x2cc07(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x20390
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x54f0
leaq -0x20f8(%rbp), %rdi
callq 0x20a80
addq $0x2630, %rsp           # imm = 0x2630
popq %rbp
retq
leaq -0x20f8(%rbp), %rdi
callq 0x20a80
movq -0x2210(%rbp), %rdi
callq 0xc1b0
movq -0x2218(%rbp), %rdi
callq 0x20640
movq -0x28(%rbp), %rdi
callq 0x5750
nopl (%rax)