// File: BenLangmead[P]bowtie/ebwt_build.cpp
// Function: void driver<SString<char>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, EList<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, 128>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
static void driver(const string& infile,
                   EList<string>& infiles,
                   const string& outfile,
                   bool reverse = false)
{
	EList<FileBuf*> is;
	bool bisulfite = false;
	RefReadInParams refparams(reverse ? reverseType : REF_READ_FORWARD, nsToAs, bisulfite);
	assert_gt(infiles.size(), 0);
	if(format == CMDLINE) {
		// Adapt sequence strings to stringstreams open for input
		stringstream *ss = new stringstream();
		for(size_t i = 0; i < infiles.size(); i++) {
			(*ss) << ">" << i << endl << infiles[i] << endl;
		}
		FileBuf *fb = new FileBuf(ss);
		assert(fb != NULL);
		assert(!fb->eof());
		assert(fb->get() == '>');
		ASSERT_ONLY(fb->reset());
		assert(!fb->eof());
		is.push_back(fb);
	} else {
		// Adapt sequence files to ifstreams
		for(size_t i = 0; i < infiles.size(); i++) {
			FileBuf *fb = NULL;
			if (FileBuf::isGzippedFile(infiles[i].c_str())) {
				gzFile zFp = gzopen(infiles[i].c_str(), "rb");
				if (zFp == NULL) {
					std::cerr << "Error: could not open " << infiles[i].c_str() << std::endl;
					throw 1;
				}
				fb = new FileBuf(zFp);
			} else {
				FILE *f = fopen(infiles[i].c_str(), "rb");
				if (f == NULL) {
					cerr << "Error: could not open "<< infiles[i] << endl;
					throw 1;
				}
				fb = new FileBuf(f);
			}
			assert(fb != NULL);
			assert(!fb->eof());
			assert(fb->get() == '>');
			ASSERT_ONLY(fb->reset());
			assert(!fb->eof());
			is.push_back(fb);
		}
	}
	// Vector for the ordered list of "records" comprising the input
	// sequences.  A record represents a stretch of unambiguous
	// characters in one of the input sequences.
	EList<RefRecord> szs;
	EList<uint32_t> plens;
	std::pair<size_t, size_t> sztot;
	{
		if(verbose) cout << "Reading reference sizes" << endl;
		Timer _t(cout, "  Time reading reference sizes: ", verbose);
		if(!reverse && (writeRef || justRef)) {
			// For forward reference, dump it to .3.ebwt and .4.ebwt
			// files
			string file3 = outfile + ".3." + gEbwt_ext;
			string file4 = outfile + ".4." + gEbwt_ext;
			// Open output stream for the '.3.ebwt' file which will
			// hold the size records.
			ofstream fout3(file3.c_str(), ios::binary);
			if(!fout3.good()) {
				cerr << "Could not open index file for writing: \"" << file3 << "\"" << endl
					 << "Please make sure the directory exists and that permissions allow writing by" << endl
					 << "Bowtie." << endl;
				throw 1;
			}
			BitpairOutFileBuf bpout(file4.c_str());
			// Read in the sizes of all the unambiguous stretches of
			// the genome into a vector of RefRecords.  The input
			// streams are reset once it's done.
			writeU<int32_t>(fout3, 1, bigEndian); // endianness sentinel
			TIndexOff numSeqs = 0;
			sztot = fastaRefReadSizes(is, szs, plens, refparams, &bpout, numSeqs);
			writeU<TIndexOffU>(fout3, (TIndexOffU)szs.size(), bigEndian); // write # records
			for(size_t i = 0; i < szs.size(); i++) szs[i].write(fout3, bigEndian);
			if(sztot.first == 0) {
				cerr << "Error: No unambiguous stretches of characters in the input.  Aborting..." << endl;
				throw 1;
			}
			assert_gt(sztot.first, 0);
			assert_gt(sztot.second, 0);
			bpout.close();
			fout3.close();
#ifndef NDEBUG
			if(sanityCheck) {
				BitPairReference bpr(
					outfile, // ebwt basename
					true,    // sanity check?
					&infiles,// files to check against
					NULL,    // sequences to check against
					format == CMDLINE, // whether infiles contains strings
					true,    // load sequence?
					false,   // use memory-mapped files
					false,   // use shared memory
					false,   // sweep through memory-mapped memory
					false,   // be talkative
					false);  // be talkative
			}
#endif
		} else {
			// Read in the sizes of all the unambiguous stretches of the
			// genome into a vector of RefRecords
			TIndexOff numSeqs = 0;
			sztot = fastaRefReadSizes(is, szs, plens, refparams, NULL, numSeqs);
		}
	}
	if(justRef) return;
	assert_gt(sztot.first, 0);
	assert_gt(sztot.second, 0);
	assert_gt(szs.size(), 0);
	// Construct Ebwt from input strings and parameters
	Ebwt ebwt(TStr(),
		  packed,
		  lineRate,
		  linesPerSide,
		  offRate,      // suffix-array sampling rate
		  -1,           // ISA sampling rate
		  ftabChars,    // number of chars in initial arrow-pair calc
		  nthreads,
		  outfile,      // basename for .?.ebwt files
		  !reverse,     // fw
		  !entireSA,    // useBlockwise
		  bmax,         // block size for blockwise SA builder
		  bmaxMultSqrt, // block size as multiplier of sqrt(len)
		  bmaxDivN,     // block size as divisor of len
		  noDc? 0 : dcv,// difference-cover period
		  is,           // list of input streams
		  szs,          // list of reference sizes
		  plens,        // list of not-all-gap reference sequence lengths
		  (TIndexOffU)sztot.first,  // total size of all unambiguous ref chars
		  refparams,    // reference read-in parameters
		  seed,         // pseudo-random number generator seed
		  -1,           // override offRate
		  -1,           // override isaRate
		  verbose,      // be talkative
		  autoMem,      // pass exceptions up to the toplevel so that we can adjust memory settings automatically
		  sanityCheck,  // verify results and internal consistency
		  false);       // are we building a bt2 index?
	// Note that the Ebwt is *not* resident in memory at this time.  To
	// load it into memory, call ebwt.loadIntoMemory()
	if(verbose) {
		// Print Ebwt's vital stats
		ebwt.eh().print(cout);
	}
	if(sanityCheck) {
		// Try restoring the original string (if there were
		// multiple texts, what we'll get back is the joined,
		// padded string, not a list)
		ebwt.loadIntoMemory(
			-1,
			false,
			false);
		BTRefString s2; ebwt.restore(s2);
		ebwt.evictFromMemory();
		{
			BTRefString joinedss = Ebwt::join<BTRefString >(
				is,          // list of input streams
				szs,         // list of reference sizes
				(TIndexOffU)sztot.first, // total size of all unambiguous ref chars
				refparams,   // reference read-in parameters
				seed);       // pseudo-random number generator seed
			if(refparams.reverse == REF_READ_REVERSE) {
				joinedss.reverse();
			}
			assert_eq(joinedss.length(), s2.length());
			assert(sstr_eq(joinedss, s2));
		}
		if(verbose) {
			if(s2.length() < 1000) {
				cout << "Passed restore check: " << s2.toZBufXForm("ACGTN") << endl;
			} else {
				cout << "Passed restore check: (" << s2.length() << " chars)" << endl;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20818, %rsp          # imm = 0x20818
movb %cl, %al
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
andb $0x1, %al
movb %al, -0x41(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x1b130
movb $0x0, -0x69(%rbp)
testb $0x1, -0x41(%rbp)
je 0xe2e8
movl 0x46be4(%rip), %eax     # 0x54ec4
movl %eax, -0x205f4(%rbp)
jmp 0xe2f2
xorl %eax, %eax
movl %eax, -0x205f4(%rbp)
jmp 0xe2f2
movl -0x205f4(%rbp), %esi
movzbl -0x69(%rbp), %ecx
movzbl 0x46bbd(%rip), %edx     # 0x54ec0
andl $0x1, %edx
andl $0x1, %ecx
leaq -0x74(%rbp), %rdi
callq 0x1b170
jmp 0xe314
cmpl $0x7, 0x46b95(%rip)     # 0x54eb0
jne 0xe4de
movl $0x188, %edi            # imm = 0x188
callq 0x6430
movq %rax, -0x20600(%rbp)
jmp 0xe334
movq -0x20600(%rbp), %rdi
callq 0x6280
jmp 0xe342
movq -0x20600(%rbp), %rax
movq %rax, -0x90(%rbp)
movq $0x0, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x20608(%rbp)
movq -0x38(%rbp), %rdi
callq 0x15ee0
movq %rax, %rcx
movq -0x20608(%rbp), %rax
cmpq %rcx, %rax
jae 0xe46c
movq -0x90(%rbp), %rdi
addq $0x10, %rdi
leaq 0x36ea5(%rip), %rsi     # 0x4523c
callq 0x6410
movq %rax, -0x20610(%rbp)
jmp 0xe3a5
movq -0x20610(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x6100
movq %rax, -0x20618(%rbp)
jmp 0xe3c1
movq -0x20618(%rbp), %rdi
movq 0x43b99(%rip), %rsi     # 0x51f68
callq 0x6470
movq %rax, -0x20620(%rbp)
jmp 0xe3dd
movq -0x38(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x16eb0
movq -0x20620(%rbp), %rdi
movq %rax, %rsi
callq 0x6380
movq %rax, -0x20628(%rbp)
jmp 0xe405
movq -0x20628(%rbp), %rdi
movq 0x43b55(%rip), %rsi     # 0x51f68
callq 0x6470
jmp 0xe41a
jmp 0xe41c
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0xe35b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xf2e4
movq -0x20600(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
movl $0x188, %esi            # imm = 0x188
callq 0x6440
jmp 0xf2e4
movl $0x42040, %edi          # imm = 0x42040
callq 0x6430
movq %rax, -0x20630(%rbp)
jmp 0xe47f
movq -0x20630(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x1b1b0
jmp 0xe494
movq -0x20630(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x1b1e0
jmp 0xe4b4
jmp 0xe7e1
movq -0x20630(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
movl $0x42040, %esi          # imm = 0x42040
callq 0x6440
jmp 0xf2e4
movq $0x0, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x20638(%rbp)
movq -0x38(%rbp), %rdi
callq 0x15ee0
movq %rax, %rcx
movq -0x20638(%rbp), %rax
cmpq %rcx, %rax
jae 0xe7df
movq $0x0, -0xb0(%rbp)
movq -0x38(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x16eb0
movq %rax, %rdi
callq 0x61b0
movq %rax, %rdi
callq 0x1b250
movb %al, -0x20639(%rbp)
jmp 0xe546
movb -0x20639(%rbp), %al
testb $0x1, %al
jne 0xe555
jmp 0xe68a
movq -0x38(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x16eb0
movq %rax, %rdi
callq 0x61b0
movq %rax, %rdi
leaq 0x35bcd(%rip), %rsi     # 0x44144
callq 0x66f0
movq %rax, -0x20648(%rbp)
jmp 0xe585
movq -0x20648(%rbp), %rax
movq %rax, -0xb8(%rbp)
cmpq $0x0, -0xb8(%rbp)
jne 0xe62a
movq 0x43a48(%rip), %rdi     # 0x51ff0
leaq 0x3762e(%rip), %rsi     # 0x45bdd
callq 0x6410
movq %rax, -0x20650(%rbp)
jmp 0xe5bd
movq -0x38(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x16eb0
movq %rax, %rdi
callq 0x61b0
movq -0x20650(%rbp), %rdi
movq %rax, %rsi
callq 0x6410
movq %rax, -0x20658(%rbp)
jmp 0xe5ed
movq -0x20658(%rbp), %rdi
movq 0x4396d(%rip), %rsi     # 0x51f68
callq 0x6470
jmp 0xe602
movl $0x4, %edi
callq 0x61f0
movq %rax, %rdi
movl $0x1, (%rdi)
movq 0x43934(%rip), %rsi     # 0x51f50
xorl %eax, %eax
movl %eax, %edx
callq 0x67f0
jmp 0xf2f6
movl $0x42040, %edi          # imm = 0x42040
callq 0x6430
movq %rax, -0x20660(%rbp)
jmp 0xe63d
movq -0x20660(%rbp), %rdi
movq -0xb8(%rbp), %rsi
callq 0x1b3c0
jmp 0xe652
movq -0x20660(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0xe7b4
movq -0x20660(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
movl $0x42040, %esi          # imm = 0x42040
callq 0x6440
jmp 0xf2e4
movq -0x38(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x16eb0
movq %rax, %rdi
callq 0x61b0
movq %rax, %rdi
leaq 0x35a98(%rip), %rsi     # 0x44144
callq 0x6500
movq %rax, -0x20668(%rbp)
jmp 0xe6ba
movq -0x20668(%rbp), %rax
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
jne 0xe757
movq 0x43913(%rip), %rdi     # 0x51ff0
leaq 0x374f9(%rip), %rsi     # 0x45bdd
callq 0x6410
movq %rax, -0x20670(%rbp)
jmp 0xe6f2
movq -0x38(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x16eb0
movq -0x20670(%rbp), %rdi
movq %rax, %rsi
callq 0x6380
movq %rax, -0x20678(%rbp)
jmp 0xe71a
movq -0x20678(%rbp), %rdi
movq 0x43840(%rip), %rsi     # 0x51f68
callq 0x6470
jmp 0xe72f
movl $0x4, %edi
callq 0x61f0
movq %rax, %rdi
movl $0x1, (%rdi)
movq 0x43807(%rip), %rsi     # 0x51f50
xorl %eax, %eax
movl %eax, %edx
callq 0x67f0
jmp 0xf2f6
movl $0x42040, %edi          # imm = 0x42040
callq 0x6430
movq %rax, -0x20680(%rbp)
jmp 0xe76a
movq -0x20680(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x1b3f0
jmp 0xe77f
movq -0x20680(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0xe7b4
movq -0x20680(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
movl $0x42040, %esi          # imm = 0x42040
callq 0x6440
jmp 0xf2e4
leaq -0x68(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x1b1e0
jmp 0xe7c6
jmp 0xe7c8
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0xe4e9
jmp 0xe7e1
leaq -0xe0(%rbp), %rdi
callq 0x1b420
jmp 0xe7ef
leaq -0x100(%rbp), %rdi
callq 0x1b460
jmp 0xe7fd
leaq -0x110(%rbp), %rdi
callq 0x1b4a0
jmp 0xe80b
testb $0x1, 0x4666a(%rip)     # 0x54e7c
je 0xe86f
movq 0x4378d(%rip), %rdi     # 0x51fa8
leaq 0x373d2(%rip), %rsi     # 0x45bf4
callq 0x6410
movq %rax, -0x20688(%rbp)
jmp 0xe830
movq -0x20688(%rbp), %rdi
movq 0x4372a(%rip), %rsi     # 0x51f68
callq 0x6470
jmp 0xe845
jmp 0xe86f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xf2d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xf2cc
movzbl 0x46606(%rip), %ecx     # 0x54e7c
andl $0x1, %ecx
movq 0x43728(%rip), %rsi     # 0x51fa8
leaq 0x37385(%rip), %rdx     # 0x45c0c
leaq -0x130(%rbp), %rdi
callq 0x16ee0
jmp 0xe895
testb $0x1, -0x41(%rbp)
jne 0xed6e
testb $0x1, 0x4661b(%rip)     # 0x54ec1
jne 0xe8b5
testb $0x1, 0x46613(%rip)     # 0x54ec2
je 0xed6e
movq -0x40(%rbp), %rsi
leaq 0x3736d(%rip), %rdx     # 0x45c2d
leaq -0x170(%rbp), %rdi
callq 0x15d70
jmp 0xe8ce
leaq 0x4868b(%rip), %rdx     # 0x56f60
leaq -0x150(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x1b4c0
jmp 0xe8ea
leaq -0x170(%rbp), %rdi
callq 0x69a8
movq -0x40(%rbp), %rsi
leaq 0x37330(%rip), %rdx     # 0x45c31
leaq -0x1b0(%rbp), %rdi
callq 0x15d70
jmp 0xe90f
leaq 0x4864a(%rip), %rdx     # 0x56f60
leaq -0x190(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x1b4c0
jmp 0xe92b
leaq -0x1b0(%rbp), %rdi
callq 0x69a8
leaq -0x150(%rbp), %rdi
callq 0x61b0
movq %rax, %rsi
leaq -0x3b0(%rbp), %rdi
movl $0x4, %edx
callq 0x64b0
jmp 0xe959
movq -0x3b0(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x3b0(%rbp,%rax), %rdi
callq 0x67d0
movb %al, -0x20689(%rbp)
jmp 0xe979
movb -0x20689(%rbp), %al
testb $0x1, %al
jne 0xeb26
jmp 0xe989
movq 0x43660(%rip), %rdi     # 0x51ff0
leaq 0x3729e(%rip), %rsi     # 0x45c35
callq 0x6410
movq %rax, -0x20698(%rbp)
jmp 0xe9a5
movq -0x20698(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x6380
movq %rax, -0x206a0(%rbp)
jmp 0xe9c1
movq -0x206a0(%rbp), %rdi
leaq 0x3728d(%rip), %rsi     # 0x45c5c
callq 0x6410
movq %rax, -0x206a8(%rbp)
jmp 0xe9dd
movq -0x206a8(%rbp), %rdi
movq 0x4357d(%rip), %rsi     # 0x51f68
callq 0x6470
movq %rax, -0x206b0(%rbp)
jmp 0xe9f9
movq -0x206b0(%rbp), %rdi
leaq 0x37257(%rip), %rsi     # 0x45c5e
callq 0x6410
movq %rax, -0x206b8(%rbp)
jmp 0xea15
movq -0x206b8(%rbp), %rdi
movq 0x43545(%rip), %rsi     # 0x51f68
callq 0x6470
movq %rax, -0x206c0(%rbp)
jmp 0xea31
movq -0x206c0(%rbp), %rdi
leaq 0x3726b(%rip), %rsi     # 0x45caa
callq 0x6410
movq %rax, -0x206c8(%rbp)
jmp 0xea4d
movq -0x206c8(%rbp), %rdi
movq 0x4350d(%rip), %rsi     # 0x51f68
callq 0x6470
jmp 0xea62
movl $0x4, %edi
callq 0x61f0
movq %rax, %rdi
movl $0x1, (%rdi)
movq 0x434d4(%rip), %rsi     # 0x51f50
xorl %eax, %eax
movl %eax, %edx
callq 0x67f0
jmp 0xf2f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xee02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x69a8
jmp 0xee02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xed5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x69a8
jmp 0xed5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xed51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x3b0(%rbp), %rdi
callq 0x66c0
jmp 0xed51
leaq -0x190(%rbp), %rdi
callq 0x61b0
movq %rax, %rsi
leaq -0x203c8(%rbp), %rdi
callq 0x1b510
jmp 0xeb43
movl 0x4635b(%rip), %eax     # 0x54ea4
testl %eax, %eax
setne %al
movzbl %al, %edx
leaq -0x3b0(%rbp), %rdi
movl $0x1, %esi
callq 0x11940
jmp 0xeb64
movl $0x0, -0x203cc(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
leaq -0x100(%rbp), %rdx
leaq -0x74(%rbp), %rcx
leaq -0x203c8(%rbp), %r8
leaq -0x203cc(%rbp), %r9
callq 0x411f0
movq %rdx, -0x206d8(%rbp)
movq %rax, -0x206d0(%rbp)
jmp 0xeba7
movq -0x206d8(%rbp), %rax
movq -0x206d0(%rbp), %rcx
movq %rcx, -0x203e0(%rbp)
movq %rax, -0x203d8(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x203e0(%rbp), %rsi
callq 0x1b5d0
leaq -0xe0(%rbp), %rdi
callq 0x1b600
movq %rax, -0x206e0(%rbp)
jmp 0xebeb
movq -0x206e0(%rbp), %rax
movl %eax, %esi
movl 0x462aa(%rip), %eax     # 0x54ea4
testl %eax, %eax
setne %al
movzbl %al, %edx
leaq -0x3b0(%rbp), %rdi
callq 0xbd10
jmp 0xec10
movq $0x0, -0x203e8(%rbp)
movq -0x203e8(%rbp), %rax
movq %rax, -0x206f0(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x1b600
movq %rax, -0x206e8(%rbp)
jmp 0xec3e
movq -0x206f0(%rbp), %rax
movq -0x206e8(%rbp), %rcx
cmpq %rcx, %rax
jae 0xeca9
movq -0x203e8(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x1b620
movq %rax, -0x206f8(%rbp)
jmp 0xec6d
movq -0x206f8(%rbp), %rdi
movl 0x4622a(%rip), %eax     # 0x54ea4
testl %eax, %eax
setne %al
movzbl %al, %edx
leaq -0x3b0(%rbp), %rsi
callq 0x1b640
jmp 0xec90
jmp 0xec92
movq -0x203e8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x203e8(%rbp)
jmp 0xec1b
cmpq $0x0, -0x110(%rbp)
jne 0xed0c
movq 0x43336(%rip), %rdi     # 0x51ff0
leaq 0x36ff1(%rip), %rsi     # 0x45cb2
callq 0x6410
movq %rax, -0x20700(%rbp)
jmp 0xeccf
movq -0x20700(%rbp), %rdi
movq 0x4328b(%rip), %rsi     # 0x51f68
callq 0x6470
jmp 0xece4
movl $0x4, %edi
callq 0x61f0
movq %rax, %rdi
movl $0x1, (%rdi)
movq 0x43252(%rip), %rsi     # 0x51f50
xorl %eax, %eax
movl %eax, %edx
callq 0x67f0
jmp 0xf2f6
leaq -0x203c8(%rbp), %rdi
callq 0x1b6b0
jmp 0xed1a
leaq -0x3b0(%rbp), %rdi
callq 0x6670
jmp 0xed28
leaq -0x3b0(%rbp), %rdi
callq 0x66c0
leaq -0x190(%rbp), %rdi
callq 0x69a8
leaq -0x150(%rbp), %rdi
callq 0x69a8
jmp 0xedde
leaq -0x190(%rbp), %rdi
callq 0x69a8
leaq -0x150(%rbp), %rdi
callq 0x69a8
jmp 0xee02
movl $0x0, -0x203ec(%rbp)
xorl %eax, %eax
movl %eax, %r8d
leaq -0x68(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
leaq -0x100(%rbp), %rdx
leaq -0x74(%rbp), %rcx
leaq -0x203ec(%rbp), %r9
callq 0x411f0
movq %rdx, -0x20710(%rbp)
movq %rax, -0x20708(%rbp)
jmp 0xedaf
movq -0x20710(%rbp), %rax
movq -0x20708(%rbp), %rcx
movq %rcx, -0x20400(%rbp)
movq %rax, -0x203f8(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x20400(%rbp), %rsi
callq 0x1b5d0
leaq -0x130(%rbp), %rdi
callq 0x16f40
testb $0x1, 0x460d1(%rip)     # 0x54ec2
je 0xee13
movl $0x1, -0x20404(%rbp)
jmp 0xf28d
leaq -0x130(%rbp), %rdi
callq 0x16f40
jmp 0xf2cc
leaq -0x205b0(%rbp), %rdi
callq 0x14b80
jmp 0xee21
movb 0x46069(%rip), %al      # 0x54e90
movb %al, -0x2073d(%rbp)
movl 0x4604d(%rip), %eax     # 0x54e80
movl %eax, -0x2073c(%rbp)
movl 0x46045(%rip), %eax     # 0x54e84
movl %eax, -0x20738(%rbp)
movl 0x4603d(%rip), %eax     # 0x54e88
movl %eax, -0x20734(%rbp)
movl 0x46035(%rip), %eax     # 0x54e8c
movl %eax, -0x20730(%rbp)
movl 0x46065(%rip), %eax     # 0x54ec8
movl %eax, -0x2072c(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x20728(%rbp)
movb -0x41(%rbp), %al
xorb $-0x1, %al
movb %al, -0x2071e(%rbp)
cmpl $0x0, 0x46036(%rip)     # 0x54ebc
setne %al
xorb $-0x1, %al
movb %al, -0x2071d(%rbp)
movl 0x45ffd(%rip), %eax     # 0x54e94
movl %eax, -0x2071c(%rbp)
movl 0x45ff5(%rip), %eax     # 0x54e98
movl %eax, -0x20718(%rbp)
movl 0x45fed(%rip), %eax     # 0x54e9c
movl %eax, -0x20714(%rbp)
cmpl $0x0, 0x45ffc(%rip)     # 0x54eb8
je 0xeec8
xorl %eax, %eax
movl %eax, -0x20744(%rbp)
jmp 0xeed4
movl 0x45fd2(%rip), %eax     # 0x54ea0
movl %eax, -0x20744(%rbp)
movl -0x20734(%rbp), %r9d
movq -0x20728(%rbp), %r10
movb -0x2071e(%rbp), %r11b
movb -0x2071d(%rbp), %bl
movl -0x2071c(%rbp), %r14d
movl -0x20718(%rbp), %r15d
movl -0x20714(%rbp), %r12d
movl -0x20744(%rbp), %r13d
movl -0x110(%rbp), %eax
movl 0x45f95(%rip), %ecx     # 0x54eac
movl 0x45f8b(%rip), %edx     # 0x54ea8
testl %edx, %edx
setne %dl
movzbl 0x45f53(%rip), %esi     # 0x54e7c
movzbl 0x45f84(%rip), %edi     # 0x54eb4
movzbl %dl, %r8d
movq %rsp, %rdx
movq %rdx, -0x20750(%rbp)
movl %r8d, 0xa0(%rdx)
movl -0x20738(%rbp), %r8d
andl $0x1, %edi
movl %edi, 0x98(%rdx)
movl -0x2072c(%rbp), %edi
andl $0x1, %esi
movl %esi, 0x90(%rdx)
movl -0x20730(%rbp), %esi
movl %ecx, 0x78(%rdx)
leaq -0x74(%rbp), %rcx
movq %rcx, 0x70(%rdx)
movl -0x2073c(%rbp), %ecx
movl %eax, 0x68(%rdx)
leaq -0x100(%rbp), %rax
movq %rax, 0x60(%rdx)
leaq -0xe0(%rbp), %rax
movq %rax, 0x58(%rdx)
leaq -0x68(%rbp), %rax
movq %rax, 0x50(%rdx)
movb -0x2073d(%rbp), %al
movl %r13d, 0x48(%rdx)
movl %r12d, 0x40(%rdx)
movl %r15d, 0x38(%rdx)
movl %r14d, 0x30(%rdx)
movzbl %bl, %ebx
andl $0x1, %ebx
movl %ebx, 0x28(%rdx)
movzbl %r11b, %r11d
andl $0x1, %r11d
movl %r11d, 0x20(%rdx)
movq %r10, 0x18(%rdx)
movl %edi, 0x10(%rdx)
movl %esi, 0x8(%rdx)
movl $0x0, 0xa8(%rdx)
movl $0xffffffff, 0x88(%rdx) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x80(%rdx) # imm = 0xFFFFFFFF
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
movzbl %al, %edx
andl $0x1, %edx
leaq -0x20590(%rbp), %rdi
leaq -0x205b0(%rbp), %rsi
callq 0x1b780
jmp 0xf010
leaq -0x205b0(%rbp), %rdi
callq 0x14c50
testb $0x1, 0x45e59(%rip)     # 0x54e7c
je 0xf085
leaq -0x20590(%rbp), %rdi
callq 0x1c920
movq %rax, -0x20758(%rbp)
jmp 0xf03a
movq -0x20758(%rbp), %rdi
movq 0x42f60(%rip), %rsi     # 0x51fa8
callq 0x14f70
jmp 0xf04f
jmp 0xf085
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x205b0(%rbp), %rdi
callq 0x14c50
jmp 0xf2cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xf2c0
cmpl $0x0, 0x45e1c(%rip)     # 0x54ea8
je 0xf277
leaq -0x20590(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x1c940
jmp 0xf0a9
leaq -0x205d0(%rbp), %rdi
callq 0x14b80
jmp 0xf0b7
leaq -0x20590(%rbp), %rdi
leaq -0x205d0(%rbp), %rsi
callq 0x8070
jmp 0xf0cc
leaq -0x20590(%rbp), %rdi
callq 0x1c990
jmp 0xf0da
movl -0x110(%rbp), %ecx
movl 0x45dc5(%rip), %r9d     # 0x54eac
leaq -0x205f0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
leaq -0x74(%rbp), %r8
callq 0x1cb10
jmp 0xf104
cmpl $0x1, -0x74(%rbp)
jne 0xf14e
leaq -0x205f0(%rbp), %rdi
callq 0x1ccf0
jmp 0xf118
jmp 0xf14e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0xf269
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x205f0(%rbp), %rdi
callq 0x14c50
jmp 0xf269
leaq -0x205f0(%rbp), %rdi
callq 0x14c50
testb $0x1, 0x45d1b(%rip)     # 0x54e7c
je 0xf25b
leaq -0x205d0(%rbp), %rdi
callq 0x14c10
cmpq $0x3e8, %rax            # imm = 0x3E8
jae 0xf1e6
movq 0x42e26(%rip), %rdi     # 0x51fa8
leaq 0x36b72(%rip), %rsi     # 0x45cfb
callq 0x6410
movq %rax, -0x20760(%rbp)
jmp 0xf197
leaq 0x36b74(%rip), %rsi     # 0x45d12
leaq -0x205d0(%rbp), %rdi
callq 0x1cd90
movq %rax, -0x20768(%rbp)
jmp 0xf1b3
movq -0x20768(%rbp), %rsi
movq -0x20760(%rbp), %rdi
callq 0x6410
movq %rax, -0x20770(%rbp)
jmp 0xf1cf
movq -0x20770(%rbp), %rdi
movq 0x42d8b(%rip), %rsi     # 0x51f68
callq 0x6470
jmp 0xf1e4
jmp 0xf259
movq 0x42dbb(%rip), %rdi     # 0x51fa8
leaq 0x36b24(%rip), %rsi     # 0x45d18
callq 0x6410
movq %rax, -0x20778(%rbp)
jmp 0xf202
leaq -0x205d0(%rbp), %rdi
callq 0x14c10
movq -0x20778(%rbp), %rdi
movq %rax, %rsi
callq 0x6100
movq %rax, -0x20780(%rbp)
jmp 0xf226
movq -0x20780(%rbp), %rdi
leaq 0x36afc(%rip), %rsi     # 0x45d30
callq 0x6410
movq %rax, -0x20788(%rbp)
jmp 0xf242
movq -0x20788(%rbp), %rdi
movq 0x42d18(%rip), %rsi     # 0x51f68
callq 0x6470
jmp 0xf257
jmp 0xf259
jmp 0xf25b
leaq -0x205d0(%rbp), %rdi
callq 0x14c50
jmp 0xf277
leaq -0x205d0(%rbp), %rdi
callq 0x14c50
jmp 0xf2c0
leaq -0x20590(%rbp), %rdi
callq 0x1ce40
movl $0x0, -0x20404(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x1d0c0
leaq -0xe0(%rbp), %rdi
callq 0x1d0e0
leaq -0x68(%rbp), %rdi
callq 0x1d110
addq $0x20818, %rsp          # imm = 0x20818
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x20590(%rbp), %rdi
callq 0x1ce40
leaq -0x100(%rbp), %rdi
callq 0x1d0c0
leaq -0xe0(%rbp), %rdi
callq 0x1d0e0
leaq -0x68(%rbp), %rdi
callq 0x1d110
movq -0x80(%rbp), %rdi
callq 0x6850
nopw %cs:(%rax,%rax)