// File: NichtJens[P]lmf2txt/LMF_IO.cpp
// Function: LMF_IO::OpenOutputLMF(char*)
bool LMF_IO::OpenOutputLMF(__int8 * LMF_Filename)
/////////////////////////////////////////////////////////////////
{
//	double				double_Dummy = 0.;
//	unsigned __int32	unsigned_int_Dummy = 0;
//	__int32				int_Dummy = 0;

	if (OutputFileIsOpen) {
		errorflag = 12; // file is already open
		return false;
	}
	output_lmf = new MyFILE(false);

	fADC8.at_least_1_signal_was_written = false;

	output_lmf->open(LMF_Filename);

	if (output_lmf->error) {
		errorflag = 11; // could not open output file
		return false;
	}

//	out_ar = new CArchive(output_lmf,CArchive::store);
//	if (!out_ar) {
//		errorflag = 13; // could not connect CAchrive to output file
//		output_lmf->Close(); output_lmf = 0;
//		return false;
//	}

	if (number_of_DAQ_source_strings_output == -1 && number_of_DAQ_source_strings > 0) {
		number_of_DAQ_source_strings_output = number_of_DAQ_source_strings;
		DAQ_source_strings_output = new std::string*[number_of_DAQ_source_strings];
		memset(DAQ_source_strings_output,0,sizeof(std::string*)*number_of_DAQ_source_strings_output);
		for (__int32 i=0;i<number_of_DAQ_source_strings;++i) {DAQ_source_strings_output[i] = new std::string(); *DAQ_source_strings_output[i] = *DAQ_source_strings[i];}
	} else number_of_DAQ_source_strings_output = 0;

	if (number_of_CCFHistory_strings_output == -1 && number_of_CCFHistory_strings > 0) {
		number_of_CCFHistory_strings_output = number_of_CCFHistory_strings;
		CCFHistory_strings_output = new std::string*[number_of_CCFHistory_strings];
		memset(CCFHistory_strings_output,0,sizeof(std::string*)*number_of_CCFHistory_strings_output);
		for (__int32 i=0;i<number_of_CCFHistory_strings;++i)  {CCFHistory_strings_output[i] = new std::string(); *CCFHistory_strings_output[i] = *CCFHistory_strings[i];}
	} else number_of_CCFHistory_strings_output = 0;

	if (number_of_DAN_source_strings_output == -1 && number_of_DAN_source_strings > 0) {
		number_of_DAN_source_strings_output = number_of_DAN_source_strings;
		DAN_source_strings_output = new std::string*[number_of_DAN_source_strings];
		memset(DAN_source_strings_output,0,sizeof(std::string*)*number_of_DAN_source_strings_output);
		for (__int32 i=0;i<number_of_DAN_source_strings;++i) {DAN_source_strings_output[i] = new std::string(); *DAN_source_strings_output[i] = *DAN_source_strings[i];}
	} else number_of_DAN_source_strings_output = 0;

	if (DAQ_ID_output == DAQ_ID_RAW32BIT) {
		if (number_of_channels_output  == 0) number_of_channels_output  = number_of_channels;
		if (max_number_of_hits_output  == 0) max_number_of_hits_output  = max_number_of_hits;
		if (number_of_channels_output == 0 || max_number_of_hits_output == 0) {errorflag =14; return false;}
		Numberofcoordinates_output = number_of_channels_output*(1+max_number_of_hits_output);
		data_format_in_userheader_output = 10;

		errorflag = 0; // no error
		OutputFileIsOpen = true;
		return true;
	}

	if (DAQ_ID_output == DAQ_ID_SIMPLE) {
		if (number_of_channels_output  == 0) number_of_channels_output  = number_of_channels;
		if (max_number_of_hits_output  == 0) max_number_of_hits_output  = max_number_of_hits;
		if (number_of_channels_output == 0 || max_number_of_hits_output == 0) {errorflag =14; return false;}
		Numberofcoordinates_output = number_of_channels_output*(1+max_number_of_hits_output);
		if (SIMPLE_DAQ_ID_Orignial == 0) SIMPLE_DAQ_ID_Orignial = DAQ_ID;
		*output_lmf << SIMPLE_DAQ_ID_Orignial;
		unsigned __int32 dummy = (unsigned __int32)(uint64_number_of_written_events);
		*output_lmf << dummy;
		*output_lmf << data_format_in_userheader_output;

		errorflag = 0; // no error
		OutputFileIsOpen = true;
		return true;
	}


	
// Preparing to write LMF-header:
// -----------------------------------
	OutputFilePathName = LMF_Filename;

	Headersize_output = 0;

	if (DAQVersion_output == (unsigned) -1) DAQVersion_output = DAQVersion;

	if (DAQVersion_output >= 20080000 && Cobold_Header_version_output == 0) Cobold_Header_version_output = 2008;
	if (Cobold_Header_version_output == 0) Cobold_Header_version_output = Cobold_Header_version;

	if (tdcresolution_output < 0.) tdcresolution_output = tdcresolution;
	if (Starttime_output == 0)	{
		Starttime_output = Starttime;
	}
	if (Stoptime_output == 0)	{
		Stoptime_output = Stoptime;
	}
	if (system_timeout_output == -1) system_timeout_output = system_timeout;
	if (time_reference_output ==  0) time_reference_output = time_reference;
	if (common_mode_output    == -1) common_mode_output    = common_mode;

	if (number_of_channels_output  == 0) number_of_channels_output  = number_of_channels;
	if (max_number_of_hits_output  == 0) max_number_of_hits_output  = max_number_of_hits;
	
	if (data_format_in_userheader_output == -2) data_format_in_userheader_output = data_format_in_userheader;
	if (DAQ_ID_output == 0) DAQ_ID_output = DAQ_ID;
	if (DAQ_ID_output == DAQ_ID_TDC8HPRAW) DAQ_ID_output = DAQ_ID_TDC8HP;

	if (DAQ_ID_output == DAQ_ID_2TDC8) {
		if (number_of_channels2_output == -1) number_of_channels2_output = number_of_channels2;
		if (max_number_of_hits2_output == -1) max_number_of_hits2_output = max_number_of_hits2;
	}

	if (max_number_of_hits2_output < 0 || max_number_of_hits2_output > 100000) max_number_of_hits2_output = max_number_of_hits_output;

	if (timestamp_format_output == (unsigned) -1) timestamp_format_output = timestamp_format;

	if (Numberofcoordinates_output == -2) {
		if (data_format_in_userheader_output == LM_SHORT)  Numberofcoordinates_output = timestamp_format_output * 2;
		if (data_format_in_userheader_output == LM_DOUBLE) Numberofcoordinates_output = timestamp_format_output == 0 ? 0 : 1;
		if (data_format_in_userheader_output == LM_SLONG)  Numberofcoordinates_output = timestamp_format_output;
		if (data_format_in_userheader_output == LM_SHORT || data_format_in_userheader_output == LM_DOUBLE || data_format_in_userheader_output == LM_SLONG) {
			Numberofcoordinates_output += number_of_channels_output  * (max_number_of_hits_output +1);
			Numberofcoordinates_output += number_of_channels2_output * (max_number_of_hits2_output+1);
		}
		if (data_format_in_userheader_output == LM_CAMAC) Numberofcoordinates_output = Numberofcoordinates;

		if (data_format_in_userheader_output == LM_USERDEF) {
			if (DAQVersion_output < 20080000) {this->errorflag = 17; return false;}
			if (DAQ_ID_output == DAQ_ID_TDC8HP) {
				//Numberofcoordinates_output = 2 + timestamp_format_output + number_of_channels_output*(1+max_number_of_hits_output); // old
				Numberofcoordinates_output = number_of_channels_output*(1+max_number_of_hits_output);
				if (LMF_Version >=9) Numberofcoordinates_output++; // for level info
			}
			if (DAQ_ID_output == DAQ_ID_TDC8 || DAQ_ID_output == DAQ_ID_2TDC8) {
				//Numberofcoordinates_output = 2 + timestamp_format_output*2 + (number_of_channels_output + number_of_channels2_output)*(1+max_number_of_hits_output); // old
				Numberofcoordinates_output = (number_of_channels_output + number_of_channels2_output)*(1+max_number_of_hits_output);
			}
			if (DAQ_ID_output == DAQ_ID_HM1) {
				//Numberofcoordinates_output = 2 + timestamp_format_output*2 + (number_of_channels_output + number_of_channels2_output)*(1+max_number_of_hits_output); // old
				Numberofcoordinates_output = (number_of_channels_output + number_of_channels2_output)*(1+max_number_of_hits_output);
			}
			if (DAQ_ID_output == DAQ_ID_FADC8) {
				Numberofcoordinates_output = 3*number_of_channels_output*(1+max_number_of_hits_output);
			}
			if (DAQ_ID_output == DAQ_ID_FADC4) {
				return false;
			}
		}
	}



//  WRITE LMF-HEADER:


	WriteFirstHeader();

	output_lmf->flush();

	Headersize_output = (unsigned __int32)(output_lmf->tell());

	unsigned __int64 seek_value;
	if (Cobold_Header_version_output <= 2002) seek_value = 3*sizeof(unsigned __int32);
	if (Cobold_Header_version_output >= 2008) seek_value = 2*sizeof(unsigned __int32) + sizeof(unsigned __int64);
	output_lmf->seek(seek_value);


	if (Cobold_Header_version_output <= 2002) *output_lmf << Headersize_output;
	if (Cobold_Header_version_output >= 2008) {
		unsigned __int64 temp = Headersize_output;
		*output_lmf << temp;
	}

	output_lmf->flush();
	output_lmf->seek(Headersize_output);

	if (LMF_Version_output == -1) {
		LMF_Version_output = LMF_Version;
		if (LMF_Version_output == -1) LMF_Version_output = 10; // XXX if necessary: modify to latest LMF version number
	}

	output_byte_counter = 0;

//  WRITE USER-HEADER
	if (Cobold_Header_version_output >= 2008 || DAQVersion_output >= 20080000) {
		*output_lmf << LMF_Header_version;
		output_byte_counter += sizeof(__int32);
	}
	if (Cobold_Header_version_output <= 2002) {
		*output_lmf << User_header_size_output;
		output_byte_counter += sizeof(__int32);
	}
	if (Cobold_Header_version_output >= 2008) {
		unsigned __int64 temp = User_header_size_output;
		*output_lmf << temp;
		output_byte_counter += sizeof(unsigned __int64);
	}

	*output_lmf << DAQVersion_output;			output_byte_counter += sizeof(__int32);	// Version is always 2nd value
	*output_lmf << DAQ_ID_output;		output_byte_counter += sizeof(__int32);	// DAQ_ID is always 3ed value

	if (DAQ_ID_output == DAQ_ID_TDC8)	 output_byte_counter += WriteTDC8PCI2Header();
	if (DAQ_ID_output == DAQ_ID_2TDC8)	 output_byte_counter += Write2TDC8PCI2Header();
	if (DAQ_ID_output == DAQ_ID_TDC8HP || DAQ_ID_output == DAQ_ID_TDC8HPRAW)	 {
		if (this->LMF_Version_output <  8) output_byte_counter += WriteTDC8HPHeader_LMFV_1_to_7();
		if (this->LMF_Version_output >= 8 && this->LMF_Version_output <= 9) output_byte_counter += WriteTDC8HPHeader_LMFV_8_to_9();
		if (this->LMF_Version_output >= 10) output_byte_counter += WriteTDC8HPHeader_LMFV_10();
	}

	if (DAQ_ID_output == DAQ_ID_HM1)	 output_byte_counter += WriteHM1Header();
	if (DAQ_ID_output == DAQ_ID_HM1_ABM) output_byte_counter += WriteHM1Header();
	if (DAQ_ID_output == DAQ_ID_CAMAC)   output_byte_counter += WriteCAMACHeader();
	if (DAQ_ID_output == DAQ_ID_TCPIP)   output_byte_counter += WriteTCPIPHeader();
	if (DAQ_ID_output == DAQ_ID_FADC8)   output_byte_counter += WritefADC8_header_LMFversion10();

	User_header_size_output = output_byte_counter;

	errorflag = 0; // no error
	OutputFileIsOpen = true;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
testb $0x1, 0x2b29(%rax)
je 0x137bb
movq -0x58(%rbp), %rax
movl $0xc, 0x12e0(%rax)
movb $0x0, -0x1(%rbp)
jmp 0x145d1
movl $0x28, %edi
callq 0x2190
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x60(%rbp)
xorl %esi, %esi
callq 0x1cf90
jmp 0x137d8
movq -0x58(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rcx, 0x2b20(%rax)
movb $0x0, 0x1a78(%rax)
movq 0x2b20(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x1cfe0
movq -0x58(%rbp), %rax
movq 0x2b20(%rax), %rax
cmpl $0x0, 0x8(%rax)
je 0x13845
movq -0x58(%rbp), %rax
movl $0xb, 0x12e0(%rax)
movb $0x0, -0x1(%rbp)
jmp 0x145d1
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x28, %esi
callq 0x21a0
jmp 0x145df
movq -0x58(%rbp), %rax
cmpl $-0x1, 0x132c(%rax)
jne 0x13939
movq -0x58(%rbp), %rax
cmpl $0x0, 0x1328(%rax)
jle 0x13939
movq -0x58(%rbp), %rax
movl 0x1328(%rax), %ecx
movl %ecx, 0x132c(%rax)
movslq 0x1328(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x1338(%rax)
movq 0x1338(%rax), %rdi
movslq 0x132c(%rax), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x20d0
movl $0x0, -0x28(%rbp)
movq -0x58(%rbp), %rcx
movl -0x28(%rbp), %eax
cmpl 0x1328(%rcx), %eax
jge 0x13937
movl $0x20, %edi
callq 0x2190
movq %rax, %rdi
movq %rdi, -0x68(%rbp)
callq 0x2260
movq -0x68(%rbp), %rsi
movq -0x58(%rbp), %rax
movq 0x1338(%rax), %rcx
movslq -0x28(%rbp), %rdx
movq %rsi, (%rcx,%rdx,8)
movq 0x1330(%rax), %rcx
movslq -0x28(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
movq 0x1338(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x138cd
jmp 0x13947
movq -0x58(%rbp), %rax
movl $0x0, 0x132c(%rax)
movq -0x58(%rbp), %rax
cmpl $-0x1, 0x12f8(%rax)
jne 0x13a3b
movq -0x58(%rbp), %rax
cmpl $0x0, 0x12f4(%rax)
jle 0x13a3b
movq -0x58(%rbp), %rax
movl 0x12f4(%rax), %ecx
movl %ecx, 0x12f8(%rax)
movslq 0x12f4(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x1308(%rax)
movq 0x1308(%rax), %rdi
movslq 0x12f8(%rax), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x20d0
movl $0x0, -0x2c(%rbp)
movq -0x58(%rbp), %rcx
movl -0x2c(%rbp), %eax
cmpl 0x12f4(%rcx), %eax
jge 0x13a39
movl $0x20, %edi
callq 0x2190
movq %rax, %rdi
movq %rdi, -0x70(%rbp)
callq 0x2260
movq -0x70(%rbp), %rsi
movq -0x58(%rbp), %rax
movq 0x1308(%rax), %rcx
movslq -0x2c(%rbp), %rdx
movq %rsi, (%rcx,%rdx,8)
movq 0x1300(%rax), %rcx
movslq -0x2c(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
movq 0x1308(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x139cf
jmp 0x13a49
movq -0x58(%rbp), %rax
movl $0x0, 0x12f8(%rax)
movq -0x58(%rbp), %rax
cmpl $-0x1, 0x1314(%rax)
jne 0x13b3d
movq -0x58(%rbp), %rax
cmpl $0x0, 0x1310(%rax)
jle 0x13b3d
movq -0x58(%rbp), %rax
movl 0x1310(%rax), %ecx
movl %ecx, 0x1314(%rax)
movslq 0x1310(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x1320(%rax)
movq 0x1320(%rax), %rdi
movslq 0x1314(%rax), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x20d0
movl $0x0, -0x30(%rbp)
movq -0x58(%rbp), %rcx
movl -0x30(%rbp), %eax
cmpl 0x1310(%rcx), %eax
jge 0x13b3b
movl $0x20, %edi
callq 0x2190
movq %rax, %rdi
movq %rdi, -0x78(%rbp)
callq 0x2260
movq -0x78(%rbp), %rsi
movq -0x58(%rbp), %rax
movq 0x1320(%rax), %rcx
movslq -0x30(%rbp), %rdx
movq %rsi, (%rcx,%rdx,8)
movq 0x1318(%rax), %rcx
movslq -0x30(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
movq 0x1320(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x13ad1
jmp 0x13b4b
movq -0x58(%rbp), %rax
movl $0x0, 0x1314(%rax)
movq -0x58(%rbp), %rax
cmpl $0x64, 0x28c(%rax)
jne 0x13c07
movq -0x58(%rbp), %rax
cmpl $0x0, 0x2c4(%rax)
jne 0x13b79
movq -0x58(%rbp), %rax
movl 0x2b4(%rax), %ecx
movl %ecx, 0x2c4(%rax)
movq -0x58(%rbp), %rax
cmpl $0x0, 0x2cc(%rax)
jne 0x13b96
movq -0x58(%rbp), %rax
movl 0x2bc(%rax), %ecx
movl %ecx, 0x2cc(%rax)
movq -0x58(%rbp), %rax
cmpl $0x0, 0x2c4(%rax)
je 0x13bb0
movq -0x58(%rbp), %rax
cmpl $0x0, 0x2cc(%rax)
jne 0x13bc7
movq -0x58(%rbp), %rax
movl $0xe, 0x12e0(%rax)
movb $0x0, -0x1(%rbp)
jmp 0x145d1
movq -0x58(%rbp), %rax
movl 0x2c4(%rax), %ecx
movl 0x2cc(%rax), %edx
addl $0x1, %edx
imull %edx, %ecx
movl %ecx, 0x2b48(%rax)
movl $0xa, 0x294(%rax)
movl $0x0, 0x12e0(%rax)
movb $0x1, 0x2b29(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x145d1
movq -0x58(%rbp), %rax
cmpl $0x65, 0x28c(%rax)
jne 0x13d1f
movq -0x58(%rbp), %rax
cmpl $0x0, 0x2c4(%rax)
jne 0x13c35
movq -0x58(%rbp), %rax
movl 0x2b4(%rax), %ecx
movl %ecx, 0x2c4(%rax)
movq -0x58(%rbp), %rax
cmpl $0x0, 0x2cc(%rax)
jne 0x13c52
movq -0x58(%rbp), %rax
movl 0x2bc(%rax), %ecx
movl %ecx, 0x2cc(%rax)
movq -0x58(%rbp), %rax
cmpl $0x0, 0x2c4(%rax)
je 0x13c6c
movq -0x58(%rbp), %rax
cmpl $0x0, 0x2cc(%rax)
jne 0x13c83
movq -0x58(%rbp), %rax
movl $0xe, 0x12e0(%rax)
movb $0x0, -0x1(%rbp)
jmp 0x145d1
movq -0x58(%rbp), %rax
movl 0x2c4(%rax), %ecx
movl 0x2cc(%rax), %edx
addl $0x1, %edx
imull %edx, %ecx
movl %ecx, 0x2b48(%rax)
cmpl $0x0, 0x27c(%rax)
jne 0x13cb8
movq -0x58(%rbp), %rax
movl 0x288(%rax), %ecx
movl %ecx, 0x27c(%rax)
movq -0x58(%rbp), %rax
movq 0x2b20(%rax), %rdi
movl 0x27c(%rax), %esi
callq 0x1caf0
movq -0x58(%rbp), %rax
movq 0x2b10(%rax), %rcx
movl %ecx, -0x34(%rbp)
movq 0x2b20(%rax), %rdi
movl -0x34(%rbp), %esi
callq 0x1caf0
movq -0x58(%rbp), %rax
movq 0x2b20(%rax), %rdi
movl 0x294(%rax), %esi
callq 0x1d170
movq -0x58(%rbp), %rax
movl $0x0, 0x12e0(%rax)
movb $0x1, 0x2b29(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x145d1
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x40, %rdi
callq 0x2250
movq -0x58(%rbp), %rax
movl $0x0, 0x2b40(%rax)
cmpl $-0x1, 0x284(%rax)
jne 0x13d57
movq -0x58(%rbp), %rax
movl 0x280(%rax), %ecx
movl %ecx, 0x284(%rax)
movq -0x58(%rbp), %rax
cmpl $0x1326580, 0x284(%rax) # imm = 0x1326580
jb 0x13d82
movq -0x58(%rbp), %rax
cmpl $0x0, 0x250(%rax)
jne 0x13d82
movq -0x58(%rbp), %rax
movl $0x7d8, 0x250(%rax)     # imm = 0x7D8
movq -0x58(%rbp), %rax
cmpl $0x0, 0x250(%rax)
jne 0x13d9f
movq -0x58(%rbp), %rax
movl 0x24c(%rax), %ecx
movl %ecx, 0x250(%rax)
movq -0x58(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd 0x12c0(%rax), %xmm0
jbe 0x13dc4
movq -0x58(%rbp), %rax
movsd 0x12b8(%rax), %xmm0
movsd %xmm0, 0x12c0(%rax)
movq -0x58(%rbp), %rax
cmpq $0x0, 0x230(%rax)
jne 0x13de4
movq -0x58(%rbp), %rax
movq 0x220(%rax), %rcx
movq %rcx, 0x230(%rax)
movq -0x58(%rbp), %rax
cmpq $0x0, 0x238(%rax)
jne 0x13e04
movq -0x58(%rbp), %rax
movq 0x228(%rax), %rcx
movq %rcx, 0x238(%rax)
movq -0x58(%rbp), %rax
cmpl $-0x1, 0x1290(%rax)
jne 0x13e21
movq -0x58(%rbp), %rax
movl 0x128c(%rax), %ecx
movl %ecx, 0x1290(%rax)
movq -0x58(%rbp), %rax
cmpl $0x0, 0x244(%rax)
jne 0x13e3e
movq -0x58(%rbp), %rax
movl 0x240(%rax), %ecx
movl %ecx, 0x244(%rax)
movq -0x58(%rbp), %rax
cmpl $-0x1, 0x1298(%rax)
jne 0x13e5b
movq -0x58(%rbp), %rax
movl 0x1294(%rax), %ecx
movl %ecx, 0x1298(%rax)
movq -0x58(%rbp), %rax
cmpl $0x0, 0x2c4(%rax)
jne 0x13e78
movq -0x58(%rbp), %rax
movl 0x2b4(%rax), %ecx
movl %ecx, 0x2c4(%rax)
movq -0x58(%rbp), %rax
cmpl $0x0, 0x2cc(%rax)
jne 0x13e95
movq -0x58(%rbp), %rax
movl 0x2bc(%rax), %ecx
movl %ecx, 0x2cc(%rax)
movq -0x58(%rbp), %rax
cmpl $-0x2, 0x294(%rax)
jne 0x13eb2
movq -0x58(%rbp), %rax
movl 0x290(%rax), %ecx
movl %ecx, 0x294(%rax)
movq -0x58(%rbp), %rax
cmpl $0x0, 0x28c(%rax)
jne 0x13ecf
movq -0x58(%rbp), %rax
movl 0x288(%rax), %ecx
movl %ecx, 0x28c(%rax)
movq -0x58(%rbp), %rax
cmpl $0x10, 0x28c(%rax)
jne 0x13eea
movq -0x58(%rbp), %rax
movl $0x8, 0x28c(%rax)
movq -0x58(%rbp), %rax
cmpl $0x5, 0x28c(%rax)
jne 0x13f33
movq -0x58(%rbp), %rax
cmpl $-0x1, 0x2c8(%rax)
jne 0x13f14
movq -0x58(%rbp), %rax
movl 0x2b8(%rax), %ecx
movl %ecx, 0x2c8(%rax)
movq -0x58(%rbp), %rax
cmpl $-0x1, 0x2d0(%rax)
jne 0x13f31
movq -0x58(%rbp), %rax
movl 0x2c0(%rax), %ecx
movl %ecx, 0x2d0(%rax)
jmp 0x13f33
movq -0x58(%rbp), %rax
cmpl $0x0, 0x2d0(%rax)
jl 0x13f50
movq -0x58(%rbp), %rax
cmpl $0x186a0, 0x2d0(%rax)   # imm = 0x186A0
jle 0x13f60
movq -0x58(%rbp), %rax
movl 0x2cc(%rax), %ecx
movl %ecx, 0x2d0(%rax)
movq -0x58(%rbp), %rax
cmpl $-0x1, 0x2ac(%rax)
jne 0x13f7d
movq -0x58(%rbp), %rax
movl 0x2a8(%rax), %ecx
movl %ecx, 0x2ac(%rax)
movq -0x58(%rbp), %rax
cmpl $-0x2, 0x2b48(%rax)
jne 0x141a6
movq -0x58(%rbp), %rax
cmpl $0x2, 0x294(%rax)
jne 0x13fad
movq -0x58(%rbp), %rax
movl 0x2ac(%rax), %ecx
shll %ecx
movl %ecx, 0x2b48(%rax)
movq -0x58(%rbp), %rax
cmpl $0x5, 0x294(%rax)
jne 0x13fd7
movq -0x58(%rbp), %rax
movl 0x2ac(%rax), %esi
movl $0x1, %ecx
xorl %edx, %edx
cmpl $0x0, %esi
cmovel %edx, %ecx
movl %ecx, 0x2b48(%rax)
movq -0x58(%rbp), %rax
cmpl $0xa, 0x294(%rax)
jne 0x13ff4
movq -0x58(%rbp), %rax
movl 0x2ac(%rax), %ecx
movl %ecx, 0x2b48(%rax)
movq -0x58(%rbp), %rax
cmpl $0x2, 0x294(%rax)
je 0x1401b
movq -0x58(%rbp), %rax
cmpl $0x5, 0x294(%rax)
je 0x1401b
movq -0x58(%rbp), %rax
cmpl $0xa, 0x294(%rax)
jne 0x1405b
movq -0x58(%rbp), %rax
movl 0x2c4(%rax), %ecx
movl 0x2cc(%rax), %edx
addl $0x1, %edx
imull %edx, %ecx
addl 0x2b48(%rax), %ecx
movl %ecx, 0x2b48(%rax)
movl 0x2c8(%rax), %ecx
movl 0x2d0(%rax), %edx
addl $0x1, %edx
imull %edx, %ecx
addl 0x2b48(%rax), %ecx
movl %ecx, 0x2b48(%rax)
movq -0x58(%rbp), %rax
cmpl $0x6, 0x294(%rax)
jne 0x14078
movq -0x58(%rbp), %rax
movl 0x270(%rax), %ecx
movl %ecx, 0x2b48(%rax)
movq -0x58(%rbp), %rax
cmpl $-0x1, 0x294(%rax)
jne 0x141a4
movq -0x58(%rbp), %rax
cmpl $0x1326580, 0x284(%rax) # imm = 0x1326580
jae 0x140b0
movq -0x58(%rbp), %rax
movl $0x11, 0x12e0(%rax)
movb $0x0, -0x1(%rbp)
jmp 0x145d1
movq -0x58(%rbp), %rax
cmpl $0x8, 0x28c(%rax)
jne 0x140f7
movq -0x58(%rbp), %rax
movl 0x2c4(%rax), %ecx
movl 0x2cc(%rax), %edx
addl $0x1, %edx
imull %edx, %ecx
movl %ecx, 0x2b48(%rax)
cmpl $0x9, 0x12a4(%rax)
jl 0x140f5
movq -0x58(%rbp), %rax
movl 0x2b48(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x2b48(%rax)
jmp 0x140f7
movq -0x58(%rbp), %rax
cmpl $0x2, 0x28c(%rax)
je 0x14111
movq -0x58(%rbp), %rax
cmpl $0x5, 0x28c(%rax)
jne 0x14133
movq -0x58(%rbp), %rax
movl 0x2c4(%rax), %ecx
addl 0x2c8(%rax), %ecx
movl 0x2cc(%rax), %edx
addl $0x1, %edx
imull %edx, %ecx
movl %ecx, 0x2b48(%rax)
movq -0x58(%rbp), %rax
cmpl $0x1, 0x28c(%rax)
jne 0x14162
movq -0x58(%rbp), %rax
movl 0x2c4(%rax), %ecx
addl 0x2c8(%rax), %ecx
movl 0x2cc(%rax), %edx
addl $0x1, %edx
imull %edx, %ecx
movl %ecx, 0x2b48(%rax)
movq -0x58(%rbp), %rax
cmpl $0x11, 0x28c(%rax)
jne 0x1418c
movq -0x58(%rbp), %rax
imull $0x3, 0x2c4(%rax), %ecx
movl 0x2cc(%rax), %edx
addl $0x1, %edx
imull %edx, %ecx
movl %ecx, 0x2b48(%rax)
movq -0x58(%rbp), %rax
cmpl $0x12, 0x28c(%rax)
jne 0x141a2
movb $0x0, -0x1(%rbp)
jmp 0x145d1
jmp 0x141a4
jmp 0x141a6
movq -0x58(%rbp), %rdi
callq 0xa760
movq -0x58(%rbp), %rax
movq 0x2b20(%rax), %rdi
callq 0x1d1d0
movq -0x58(%rbp), %rax
movq 0x2b20(%rax), %rdi
callq 0x1d110
movq %rax, %rcx
movq -0x58(%rbp), %rax
movl %ecx, 0x2b40(%rax)
cmpl $0x7d2, 0x250(%rax)     # imm = 0x7D2
jg 0x141f0
movq $0xc, -0x40(%rbp)
movq -0x58(%rbp), %rax
cmpl $0x7d8, 0x250(%rax)     # imm = 0x7D8
jl 0x14208
movq $0x10, -0x40(%rbp)
movq -0x58(%rbp), %rax
movq 0x2b20(%rax), %rdi
movq -0x40(%rbp), %rsi
callq 0x2440
movq -0x58(%rbp), %rax
cmpl $0x7d2, 0x250(%rax)     # imm = 0x7D2
jg 0x14242
movq -0x58(%rbp), %rax
movq 0x2b20(%rax), %rdi
movl 0x2b40(%rax), %esi
callq 0x1caf0
movq -0x58(%rbp), %rax
cmpl $0x7d8, 0x250(%rax)     # imm = 0x7D8
jl 0x14270
movq -0x58(%rbp), %rax
movl 0x2b40(%rax), %ecx
movq %rcx, -0x48(%rbp)
movq 0x2b20(%rax), %rdi
movq -0x48(%rbp), %rsi
callq 0x1cce0
movq -0x58(%rbp), %rax
movq 0x2b20(%rax), %rdi
callq 0x1d1d0
movq -0x58(%rbp), %rax
movq 0x2b20(%rax), %rdi
movl 0x2b40(%rax), %eax
movl %eax, %esi
callq 0x2440
movq -0x58(%rbp), %rax
cmpl $-0x1, 0x12a8(%rax)
jne 0x142ce
movq -0x58(%rbp), %rax
movl 0x12a4(%rax), %ecx
movl %ecx, 0x12a8(%rax)
cmpl $-0x1, 0x12a8(%rax)
jne 0x142cc
movq -0x58(%rbp), %rax
movl $0xa, 0x12a8(%rax)
jmp 0x142ce
movq -0x58(%rbp), %rax
movl $0x0, 0x2b44(%rax)
cmpl $0x7d8, 0x250(%rax)     # imm = 0x7D8
jge 0x142f8
movq -0x58(%rbp), %rax
cmpl $0x1326580, 0x284(%rax) # imm = 0x1326580
jb 0x14323
movq -0x58(%rbp), %rax
movq 0x2b20(%rax), %rdi
movl 0x12b0(%rax), %esi
callq 0x1caf0
movq -0x58(%rbp), %rax
movslq 0x2b44(%rax), %rcx
addq $0x4, %rcx
movl %ecx, 0x2b44(%rax)
movq -0x58(%rbp), %rax
cmpl $0x7d2, 0x250(%rax)     # imm = 0x7D2
jg 0x1435e
movq -0x58(%rbp), %rax
movq 0x2b20(%rax), %rdi
movl 0x2a0(%rax), %esi
callq 0x1caf0
movq -0x58(%rbp), %rax
movslq 0x2b44(%rax), %rcx
addq $0x4, %rcx
movl %ecx, 0x2b44(%rax)
movq -0x58(%rbp), %rax
cmpl $0x7d8, 0x250(%rax)     # imm = 0x7D8
jl 0x143a1
movq -0x58(%rbp), %rax
movl 0x2a0(%rax), %ecx
movq %rcx, -0x50(%rbp)
movq 0x2b20(%rax), %rdi
movq -0x50(%rbp), %rsi
callq 0x1cce0
movq -0x58(%rbp), %rax
movslq 0x2b44(%rax), %rcx
addq $0x8, %rcx
movl %ecx, 0x2b44(%rax)
movq -0x58(%rbp), %rax
movq 0x2b20(%rax), %rdi
movl 0x284(%rax), %esi
callq 0x1caf0
movq -0x58(%rbp), %rax
movslq 0x2b44(%rax), %rcx
addq $0x4, %rcx
movl %ecx, 0x2b44(%rax)
movq 0x2b20(%rax), %rdi
movl 0x28c(%rax), %esi
callq 0x1caf0
movq -0x58(%rbp), %rax
movslq 0x2b44(%rax), %rcx
addq $0x4, %rcx
movl %ecx, 0x2b44(%rax)
cmpl $0x2, 0x28c(%rax)
jne 0x14417
movq -0x58(%rbp), %rdi
callq 0xa1f0
movl %eax, %ecx
movq -0x58(%rbp), %rax
addl 0x2b44(%rax), %ecx
movl %ecx, 0x2b44(%rax)
movq -0x58(%rbp), %rax
cmpl $0x5, 0x28c(%rax)
jne 0x1443f
movq -0x58(%rbp), %rdi
callq 0xfcf0
movl %eax, %ecx
movq -0x58(%rbp), %rax
addl 0x2b44(%rax), %ecx
movl %ecx, 0x2b44(%rax)
movq -0x58(%rbp), %rax
cmpl $0x8, 0x28c(%rax)
je 0x1445d
movq -0x58(%rbp), %rax
cmpl $0x10, 0x28c(%rax)
jne 0x144e4
movq -0x58(%rbp), %rax
cmpl $0x8, 0x12a8(%rax)
jge 0x14485
movq -0x58(%rbp), %rdi
callq 0x10320
movl %eax, %ecx
movq -0x58(%rbp), %rax
addl 0x2b44(%rax), %ecx
movl %ecx, 0x2b44(%rax)
movq -0x58(%rbp), %rax
cmpl $0x8, 0x12a8(%rax)
jl 0x144ba
movq -0x58(%rbp), %rax
cmpl $0x9, 0x12a8(%rax)
jg 0x144ba
movq -0x58(%rbp), %rdi
callq 0x11030
movl %eax, %ecx
movq -0x58(%rbp), %rax
addl 0x2b44(%rax), %ecx
movl %ecx, 0x2b44(%rax)
movq -0x58(%rbp), %rax
cmpl $0xa, 0x12a8(%rax)
jl 0x144e2
movq -0x58(%rbp), %rdi
callq 0x11f00
movl %eax, %ecx
movq -0x58(%rbp), %rax
addl 0x2b44(%rax), %ecx
movl %ecx, 0x2b44(%rax)
jmp 0x144e4
movq -0x58(%rbp), %rax
cmpl $0x1, 0x28c(%rax)
jne 0x1450c
movq -0x58(%rbp), %rdi
callq 0x12bf0
movl %eax, %ecx
movq -0x58(%rbp), %rax
addl 0x2b44(%rax), %ecx
movl %ecx, 0x2b44(%rax)
movq -0x58(%rbp), %rax
cmpl $0x6, 0x28c(%rax)
jne 0x14534
movq -0x58(%rbp), %rdi
callq 0x12bf0
movl %eax, %ecx
movq -0x58(%rbp), %rax
addl 0x2b44(%rax), %ecx
movl %ecx, 0x2b44(%rax)
movq -0x58(%rbp), %rax
cmpl $0x3, 0x28c(%rax)
jne 0x1455c
movq -0x58(%rbp), %rdi
callq 0x13540
movl %eax, %ecx
movq -0x58(%rbp), %rax
addl 0x2b44(%rax), %ecx
movl %ecx, 0x2b44(%rax)
movq -0x58(%rbp), %rax
cmpl $0x9, 0x28c(%rax)
jne 0x14584
movq -0x58(%rbp), %rdi
callq 0xfb40
movl %eax, %ecx
movq -0x58(%rbp), %rax
addl 0x2b44(%rax), %ecx
movl %ecx, 0x2b44(%rax)
movq -0x58(%rbp), %rax
cmpl $0x11, 0x28c(%rax)
jne 0x145ac
movq -0x58(%rbp), %rdi
callq 0xcde0
movl %eax, %ecx
movq -0x58(%rbp), %rax
addl 0x2b44(%rax), %ecx
movl %ecx, 0x2b44(%rax)
movq -0x58(%rbp), %rax
movl 0x2b44(%rax), %ecx
movl %ecx, 0x2a0(%rax)
movl $0x0, 0x12e0(%rax)
movb $0x1, 0x2b29(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x80, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x22f0
nopl (%rax,%rax)