// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x1, 0x2b29(%rdi)
jne 0xda92
movl $0xc, 0x12e0(%rbx)
jmp 0xdae8
movq %rsi, %r14
movl $0x28, %edi
callq 0x2130
movl $0x0, 0x8(%rax)
xorl %ecx, %ecx
movb %cl, 0xc(%rax)
movb %cl, 0x18(%rax)
movq %rcx, (%rax)
movq %rcx, 0x20(%rax)
movq %rcx, 0x10(%rax)
movq %rax, 0x2b20(%rbx)
movb %cl, 0x1a78(%rbx)
movq %rax, %rdi
movq %r14, %rsi
callq 0x13bba
movq 0x2b20(%rbx), %rax
cmpl $0x0, 0x8(%rax)
je 0xdaf6
movl $0xb, 0x12e0(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
cmpl $-0x1, 0x132c(%rbx)
je 0xdbb3
movl $0x0, 0x132c(%rbx)
cmpl $-0x1, 0x12f8(%rbx)
je 0xdc51
movl $0x0, 0x12f8(%rbx)
cmpl $-0x1, 0x1314(%rbx)
je 0xdcef
movl $0x0, 0x1314(%rbx)
movl 0x28c(%rbx), %eax
cmpl $0x65, %eax
je 0xdd8d
cmpl $0x64, %eax
jne 0xde35
cmpl $0x0, 0x2c4(%rbx)
jne 0xdb68
movl 0x2b4(%rbx), %eax
movl %eax, 0x2c4(%rbx)
cmpl $0x0, 0x2cc(%rbx)
jne 0xdb7d
movl 0x2bc(%rbx), %eax
movl %eax, 0x2cc(%rbx)
movl 0x2c4(%rbx), %eax
testl %eax, %eax
je 0xde26
movl 0x2cc(%rbx), %ecx
testl %ecx, %ecx
je 0xde26
incl %ecx
imull %eax, %ecx
movl %ecx, 0x2b48(%rbx)
movl $0xa, 0x294(%rbx)
jmp 0xe468
movslq 0x1328(%rbx), %r15
testq %r15, %r15
jle 0xdb03
movl %r15d, 0x132c(%rbx)
shlq $0x3, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x1338(%rbx)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20b0
cmpl $0x0, 0x1328(%rbx)
jle 0xdb0d
xorl %r15d, %r15d
movl $0x20, %edi
callq 0x2130
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x1338(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
movq 0x1330(%rbx), %rax
movq 0x1338(%rbx), %rcx
movq (%rax,%r15,8), %rsi
movq (%rcx,%r15,8), %rdi
callq 0x20a0
incq %r15
movslq 0x1328(%rbx), %rax
cmpq %rax, %r15
jl 0xdbfa
jmp 0xdb0d
movslq 0x12f4(%rbx), %r15
testq %r15, %r15
jle 0xdb1a
movl %r15d, 0x12f8(%rbx)
shlq $0x3, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x1308(%rbx)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20b0
cmpl $0x0, 0x12f4(%rbx)
jle 0xdb24
xorl %r15d, %r15d
movl $0x20, %edi
callq 0x2130
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x1308(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
movq 0x1300(%rbx), %rax
movq 0x1308(%rbx), %rcx
movq (%rax,%r15,8), %rsi
movq (%rcx,%r15,8), %rdi
callq 0x20a0
incq %r15
movslq 0x12f4(%rbx), %rax
cmpq %rax, %r15
jl 0xdc98
jmp 0xdb24
movslq 0x1310(%rbx), %r15
testq %r15, %r15
jle 0xdb31
movl %r15d, 0x1314(%rbx)
shlq $0x3, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x1320(%rbx)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20b0
cmpl $0x0, 0x1310(%rbx)
jle 0xdb3b
xorl %r15d, %r15d
movl $0x20, %edi
callq 0x2130
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x1320(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
movq 0x1318(%rbx), %rax
movq 0x1320(%rbx), %rcx
movq (%rax,%r15,8), %rsi
movq (%rcx,%r15,8), %rdi
callq 0x20a0
incq %r15
movslq 0x1310(%rbx), %rax
cmpq %rax, %r15
jl 0xdd36
jmp 0xdb3b
cmpl $0x0, 0x2c4(%rbx)
jne 0xdda2
movl 0x2b4(%rbx), %eax
movl %eax, 0x2c4(%rbx)
cmpl $0x0, 0x2cc(%rbx)
jne 0xddb7
movl 0x2bc(%rbx), %eax
movl %eax, 0x2cc(%rbx)
movl 0x2c4(%rbx), %eax
testl %eax, %eax
je 0xde26
movl 0x2cc(%rbx), %ecx
testl %ecx, %ecx
je 0xde26
incl %ecx
imull %eax, %ecx
movl %ecx, 0x2b48(%rbx)
cmpl $0x0, 0x27c(%rbx)
jne 0xddeb
movl 0x288(%rbx), %eax
movl %eax, 0x27c(%rbx)
movq 0x2b20(%rbx), %rdi
movl 0x27c(%rbx), %esi
callq 0x13968
movl 0x2b10(%rbx), %esi
movq 0x2b20(%rbx), %rdi
callq 0x13968
movq 0x2b20(%rbx), %rdi
movl 0x294(%rbx), %esi
callq 0x13c82
jmp 0xe468
movl $0xe, 0x12e0(%rbx)
jmp 0xdae8
leaq 0x40(%rbx), %r15
movq 0x48(%rbx), %r12
movq %r14, %rdi
callq 0x2090
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rax, %r8
callq 0x21f0
movl $0x0, 0x2b40(%rbx)
cmpl $-0x1, 0x284(%rbx)
jne 0xde77
movl 0x280(%rbx), %eax
movl %eax, 0x284(%rbx)
movl 0x284(%rbx), %ecx
cmpl $0x1326580, %ecx        # imm = 0x1326580
jb 0xde98
cmpl $0x0, 0x250(%rbx)
jne 0xde98
movl $0x7d8, 0x250(%rbx)     # imm = 0x7D8
cmpl $0x0, 0x250(%rbx)
jne 0xdead
movl 0x24c(%rbx), %eax
movl %eax, 0x250(%rbx)
xorpd %xmm0, %xmm0
ucomisd 0x12c0(%rbx), %xmm0
jbe 0xdecb
movsd 0x12b8(%rbx), %xmm0
movsd %xmm0, 0x12c0(%rbx)
cmpq $0x0, 0x230(%rbx)
jne 0xdee3
movq 0x220(%rbx), %rax
movq %rax, 0x230(%rbx)
cmpq $0x0, 0x238(%rbx)
jne 0xdefb
movq 0x228(%rbx), %rax
movq %rax, 0x238(%rbx)
cmpl $-0x1, 0x1290(%rbx)
jne 0xdf10
movl 0x128c(%rbx), %eax
movl %eax, 0x1290(%rbx)
cmpl $0x0, 0x244(%rbx)
jne 0xdf25
movl 0x240(%rbx), %eax
movl %eax, 0x244(%rbx)
cmpl $-0x1, 0x1298(%rbx)
jne 0xdf3a
movl 0x1294(%rbx), %eax
movl %eax, 0x1298(%rbx)
cmpl $0x0, 0x2c4(%rbx)
jne 0xdf4f
movl 0x2b4(%rbx), %eax
movl %eax, 0x2c4(%rbx)
cmpl $0x0, 0x2cc(%rbx)
jne 0xdf64
movl 0x2bc(%rbx), %eax
movl %eax, 0x2cc(%rbx)
cmpl $-0x2, 0x294(%rbx)
jne 0xdf79
movl 0x290(%rbx), %eax
movl %eax, 0x294(%rbx)
cmpl $0x0, 0x28c(%rbx)
jne 0xdf8e
movl 0x288(%rbx), %eax
movl %eax, 0x28c(%rbx)
cmpl $0x10, 0x28c(%rbx)
jne 0xdfa1
movl $0x8, 0x28c(%rbx)
movl 0x28c(%rbx), %eax
cmpl $0x5, %eax
jne 0xdfd6
cmpl $-0x1, 0x2c8(%rbx)
jne 0xdfc1
movl 0x2b8(%rbx), %edx
movl %edx, 0x2c8(%rbx)
cmpl $-0x1, 0x2d0(%rbx)
jne 0xdfd6
movl 0x2c0(%rbx), %edx
movl %edx, 0x2d0(%rbx)
cmpl $0x186a1, 0x2d0(%rbx)   # imm = 0x186A1
jb 0xdfee
movl 0x2cc(%rbx), %edx
movl %edx, 0x2d0(%rbx)
cmpl $-0x1, 0x2ac(%rbx)
jne 0xe003
movl 0x2a8(%rbx), %edx
movl %edx, 0x2ac(%rbx)
cmpl $-0x2, 0x2b48(%rbx)
jne 0xe1b4
movl 0x294(%rbx), %edx
leal 0x1(%rdx), %esi
cmpl $0xb, %esi
ja 0xe1b4
leaq 0x7087(%rip), %rdi      # 0x150b0
movslq (%rdi,%rsi,4), %rsi
addq %rdi, %rsi
jmpq *%rsi
movl 0x2ac(%rbx), %esi
addl %esi, %esi
jmp 0xe051
xorl %esi, %esi
cmpl $0x0, 0x2ac(%rbx)
setne %sil
jmp 0xe051
movl 0x2ac(%rbx), %esi
movl 0x2cc(%rbx), %edi
incl %edi
imull 0x2c4(%rbx), %edi
movl 0x2d0(%rbx), %r8d
incl %r8d
imull 0x2c8(%rbx), %r8d
addl %esi, %edi
addl %edi, %r8d
movl %r8d, 0x2b48(%rbx)
cmpl $-0x1, %edx
je 0xe0a1
cmpl $0x6, %edx
jne 0xe1b4
movl 0x270(%rbx), %esi
movl %esi, 0x2b48(%rbx)
cmpl $-0x1, %edx
jne 0xe1b4
cmpl $0x132657f, %ecx        # imm = 0x132657F
ja 0xe0b8
movl $0x11, 0x12e0(%rbx)
jmp 0xdae8
leal -0x1(%rax), %ecx
cmpl $0x7, %ecx
ja 0xe109
leaq 0x7019(%rip), %rdx      # 0x150e0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl 0x2c8(%rbx), %ecx
movl 0x2cc(%rbx), %edx
addl 0x2c4(%rbx), %ecx
incl %edx
imull %ecx, %edx
movl %edx, 0x2b48(%rbx)
cmpl $0x12, %eax
je 0xdae8
cmpl $0x11, %eax
je 0xe193
cmpl $0x1, %eax
je 0xe168
jmp 0xe1b4
cmpl $0x11, %eax
jne 0xe1ab
jmp 0xe193
movl 0x2cc(%rbx), %ecx
incl %ecx
imull 0x2c4(%rbx), %ecx
movl %ecx, 0x2b48(%rbx)
cmpl $0x9, 0x12a4(%rbx)
jl 0xe13a
incl %ecx
movl %ecx, 0x2b48(%rbx)
cmpl $0x4, %eax
jle 0xe158
cmpl $0x12, %eax
je 0xdae8
cmpl $0x11, %eax
je 0xe193
cmpl $0x5, %eax
je 0xe0d0
jmp 0xe1b4
cmpl $0x1, %eax
je 0xe168
cmpl $0x2, %eax
je 0xe0d0
jmp 0xe1b4
movl 0x2c8(%rbx), %ecx
movl 0x2cc(%rbx), %edx
addl 0x2c4(%rbx), %ecx
incl %edx
imull %ecx, %edx
movl %edx, 0x2b48(%rbx)
cmpl $0x12, %eax
je 0xdae8
cmpl $0x11, %eax
jne 0xe1b4
movl 0x2cc(%rbx), %ecx
incl %ecx
imull 0x2c4(%rbx), %ecx
leal (%rcx,%rcx,2), %ecx
movl %ecx, 0x2b48(%rbx)
cmpl $0x12, %eax
je 0xdae8
movq %rbx, %rdi
callq 0x80e2
movq 0x2b20(%rbx), %rax
movq (%rax), %rdi
callq 0x2160
movq 0x2b20(%rbx), %r15
movl 0x20(%r15), %eax
movl %eax, 0x2b40(%rbx)
xorl %eax, %eax
cmpl $0x7d8, 0x250(%rbx)     # imm = 0x7D8
setge %al
leaq 0xc(,%rax,4), %r14
movq (%r15), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x20c0
testl %eax, %eax
je 0xe20e
movl $0x1, 0x8(%r15)
jmp 0xe212
movq %r14, 0x20(%r15)
cmpl $0x7d2, 0x250(%rbx)     # imm = 0x7D2
jg 0xe230
movq 0x2b20(%rbx), %rdi
movl 0x2b40(%rbx), %esi
callq 0x13968
cmpl $0x7d8, 0x250(%rbx)     # imm = 0x7D8
jl 0xe24e
movl 0x2b40(%rbx), %esi
movq 0x2b20(%rbx), %rdi
callq 0x13a38
movq 0x2b20(%rbx), %rax
movq (%rax), %rdi
callq 0x2160
movq 0x2b20(%rbx), %r15
movl 0x2b40(%rbx), %r14d
movq (%r15), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x20c0
testl %eax, %eax
je 0xe286
movl $0x1, 0x8(%r15)
jmp 0xe28a
movq %r14, 0x20(%r15)
cmpl $-0x1, 0x12a8(%rbx)
jne 0xe2aa
movl 0x12a4(%rbx), %eax
cmpl $-0x1, %eax
movl $0xa, %ecx
cmovnel %eax, %ecx
movl %ecx, 0x12a8(%rbx)
movl $0x0, 0x2b44(%rbx)
cmpl $0x7d7, 0x250(%rbx)     # imm = 0x7D7
jg 0xe2cc
cmpl $0x1326580, 0x284(%rbx) # imm = 0x1326580
jb 0xe2e5
movq 0x2b20(%rbx), %rdi
movl 0x12b0(%rbx), %esi
callq 0x13968
addl $0x4, 0x2b44(%rbx)
cmpl $0x7d2, 0x250(%rbx)     # imm = 0x7D2
jg 0xe30a
movq 0x2b20(%rbx), %rdi
movl 0x2a0(%rbx), %esi
callq 0x13968
addl $0x4, 0x2b44(%rbx)
cmpl $0x7d8, 0x250(%rbx)     # imm = 0x7D8
jl 0xe32f
movl 0x2a0(%rbx), %esi
movq 0x2b20(%rbx), %rdi
callq 0x13a38
addl $0x8, 0x2b44(%rbx)
movq 0x2b20(%rbx), %rdi
movl 0x284(%rbx), %esi
callq 0x13968
addl $0x4, 0x2b44(%rbx)
movq 0x2b20(%rbx), %rdi
movl 0x28c(%rbx), %esi
callq 0x13968
addl $0x4, 0x2b44(%rbx)
cmpl $0x2, 0x28c(%rbx)
jne 0xe378
movq %rbx, %rdi
callq 0x7db8
addl %eax, 0x2b44(%rbx)
cmpl $0x5, 0x28c(%rbx)
jne 0xe38f
movq %rbx, %rdi
callq 0xb620
addl %eax, 0x2b44(%rbx)
movl 0x28c(%rbx), %eax
cmpl $0x10, %eax
je 0xe39f
cmpl $0x8, %eax
jne 0xe3e9
cmpl $0x7, 0x12a8(%rbx)
jg 0xe3b6
movq %rbx, %rdi
callq 0xb98a
addl %eax, 0x2b44(%rbx)
movl 0x12a8(%rbx), %eax
andl $-0x2, %eax
cmpl $0x8, %eax
jne 0xe3d2
movq %rbx, %rdi
callq 0xc1ec
addl %eax, 0x2b44(%rbx)
cmpl $0xa, 0x12a8(%rbx)
jl 0xe3e9
movq %rbx, %rdi
callq 0xcba0
addl %eax, 0x2b44(%rbx)
cmpl $0x1, 0x28c(%rbx)
jne 0xe400
movq %rbx, %rdi
callq 0xd428
addl %eax, 0x2b44(%rbx)
cmpl $0x6, 0x28c(%rbx)
jne 0xe417
movq %rbx, %rdi
callq 0xd428
addl %eax, 0x2b44(%rbx)
cmpl $0x3, 0x28c(%rbx)
jne 0xe42e
movq %rbx, %rdi
callq 0xd982
addl %eax, 0x2b44(%rbx)
cmpl $0x9, 0x28c(%rbx)
jne 0xe445
movq %rbx, %rdi
callq 0xb54a
addl %eax, 0x2b44(%rbx)
cmpl $0x11, 0x28c(%rbx)
jne 0xe45c
movq %rbx, %rdi
callq 0x9934
addl %eax, 0x2b44(%rbx)
movl 0x2b44(%rbx), %eax
movl %eax, 0x2a0(%rbx)
movl $0x0, 0x12e0(%rbx)
movb $0x1, 0x2b29(%rbx)
movb $0x1, %al
jmp 0xdaea