// File: /workspace/github_cpp_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpb $0x1, 0x2b29(%rdi)
jne 0xba6f
movl $0xc, 0x12e0(%rbx)
jmp 0xbac3
movq %rsi, %r14
pushq $0x28
popq %rdi
callq 0x2130
andl $0x0, 0x8(%rax)
xorl %ecx, %ecx
movb %cl, 0xc(%rax)
movb %cl, 0x18(%rax)
andq $0x0, (%rax)
andq $0x0, 0x20(%rax)
andq $0x0, 0x10(%rax)
movq %rax, 0x2b20(%rbx)
movb %cl, 0x1a78(%rbx)
movq %rax, %rdi
movq %r14, %rsi
callq 0x10fdc
movq 0x2b20(%rbx), %rax
cmpl $0x0, 0x8(%rax)
je 0xbacf
movl $0xb, 0x12e0(%rbx)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
cmpl $-0x1, 0x132c(%rbx)
je 0xbb81
andl $0x0, 0x132c(%rbx)
cmpl $-0x1, 0x12f8(%rbx)
je 0xbc18
andl $0x0, 0x12f8(%rbx)
cmpl $-0x1, 0x1314(%rbx)
je 0xbcaf
andl $0x0, 0x1314(%rbx)
movl 0x28c(%rbx), %eax
cmpl $0x65, %eax
je 0xbd46
cmpl $0x64, %eax
jne 0xbd95
movl 0x2c4(%rbx), %eax
testl %eax, %eax
jne 0xbb39
movl 0x2b4(%rbx), %eax
movl %eax, 0x2c4(%rbx)
movl 0x2cc(%rbx), %ecx
testl %ecx, %ecx
jne 0xbb4f
movl 0x2bc(%rbx), %ecx
movl %ecx, 0x2cc(%rbx)
testl %eax, %eax
sete %dl
testl %ecx, %ecx
sete %sil
orb %dl, %sil
cmpb $0x1, %sil
je 0xbd86
incl %ecx
imull %eax, %ecx
movl %ecx, 0x2b48(%rbx)
movl $0xa, 0x294(%rbx)
jmp 0xc30e
movslq 0x1328(%rbx), %r13
testq %r13, %r13
jle 0xbadc
movl %r13d, 0x132c(%rbx)
movq %r13, %r15
shlq $0x3, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x1338(%rbx)
xorl %r12d, %r12d
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20b0
pushq $0x20
popq %r15
movslq %r13d, %rax
cmpq %rax, %r12
jge 0xbae3
movq %r15, %rdi
callq 0x2130
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
andq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x1338(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x1330(%rbx), %rax
movq 0x1338(%rbx), %rcx
movq (%rax,%r12,8), %rsi
movq (%rcx,%r12,8), %rdi
callq 0x20a0
incq %r12
movl 0x1328(%rbx), %r13d
jmp 0xbbc2
movslq 0x12f4(%rbx), %r13
testq %r13, %r13
jle 0xbaf0
movl %r13d, 0x12f8(%rbx)
movq %r13, %r15
shlq $0x3, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x1308(%rbx)
xorl %r12d, %r12d
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20b0
pushq $0x20
popq %r15
movslq %r13d, %rax
cmpq %rax, %r12
jge 0xbaf7
movq %r15, %rdi
callq 0x2130
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
andq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x1308(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x1300(%rbx), %rax
movq 0x1308(%rbx), %rcx
movq (%rax,%r12,8), %rsi
movq (%rcx,%r12,8), %rdi
callq 0x20a0
incq %r12
movl 0x12f4(%rbx), %r13d
jmp 0xbc59
movslq 0x1310(%rbx), %r13
testq %r13, %r13
jle 0xbb04
movl %r13d, 0x1314(%rbx)
movq %r13, %r15
shlq $0x3, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x1320(%rbx)
xorl %r12d, %r12d
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20b0
pushq $0x20
popq %r15
movslq %r13d, %rax
cmpq %rax, %r12
jge 0xbb0b
movq %r15, %rdi
callq 0x2130
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
andq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x1320(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x1318(%rbx), %rax
movq 0x1320(%rbx), %rcx
movq (%rax,%r12,8), %rsi
movq (%rcx,%r12,8), %rdi
callq 0x20a0
incq %r12
movl 0x1310(%rbx), %r13d
jmp 0xbcf0
movl 0x2c4(%rbx), %eax
testl %eax, %eax
jne 0xbd5c
movl 0x2b4(%rbx), %eax
movl %eax, 0x2c4(%rbx)
movl 0x2cc(%rbx), %ecx
testl %ecx, %ecx
jne 0xbd72
movl 0x2bc(%rbx), %ecx
movl %ecx, 0x2cc(%rbx)
testl %eax, %eax
sete %dl
testl %ecx, %ecx
sete %sil
orb %dl, %sil
cmpb $0x1, %sil
jne 0xbddc
movl $0xe, 0x12e0(%rbx)
jmp 0xbac3
leaq 0x40(%rbx), %rdi
movq %r14, %rsi
callq 0x2230
andl $0x0, 0x2b40(%rbx)
movl 0x284(%rbx), %eax
cmpl $-0x1, %eax
jne 0xbdbf
movl 0x280(%rbx), %eax
movl %eax, 0x284(%rbx)
movl 0x250(%rbx), %ecx
cmpl $0x1326580, %eax        # imm = 0x1326580
jb 0xbe32
testl %ecx, %ecx
jne 0xbe42
movl $0x7d8, 0x250(%rbx)     # imm = 0x7D8
jmp 0xbe42
incl %ecx
imull %eax, %ecx
movl %ecx, 0x2b48(%rbx)
movl 0x27c(%rbx), %esi
testl %esi, %esi
jne 0xbdfd
movl 0x288(%rbx), %esi
movl %esi, 0x27c(%rbx)
movq 0x2b20(%rbx), %rdi
callq 0x10d1e
movl 0x2b10(%rbx), %esi
movq 0x2b20(%rbx), %rdi
callq 0x10d1e
movq 0x2b20(%rbx), %rdi
movl 0x294(%rbx), %esi
callq 0x11094
jmp 0xc30e
testl %ecx, %ecx
jne 0xbe42
movl 0x24c(%rbx), %ecx
movl %ecx, 0x250(%rbx)
xorpd %xmm0, %xmm0
ucomisd 0x12c0(%rbx), %xmm0
jbe 0xbe60
movsd 0x12b8(%rbx), %xmm0
movsd %xmm0, 0x12c0(%rbx)
cmpq $0x0, 0x230(%rbx)
jne 0xbe78
movq 0x220(%rbx), %rcx
movq %rcx, 0x230(%rbx)
cmpq $0x0, 0x238(%rbx)
jne 0xbe90
movq 0x228(%rbx), %rcx
movq %rcx, 0x238(%rbx)
cmpl $-0x1, 0x1290(%rbx)
jne 0xbea5
movl 0x128c(%rbx), %ecx
movl %ecx, 0x1290(%rbx)
cmpl $0x0, 0x244(%rbx)
jne 0xbeba
movl 0x240(%rbx), %ecx
movl %ecx, 0x244(%rbx)
cmpl $-0x1, 0x1298(%rbx)
jne 0xbecf
movl 0x1294(%rbx), %ecx
movl %ecx, 0x1298(%rbx)
movl 0x2c4(%rbx), %edx
testl %edx, %edx
jne 0xbee5
movl 0x2b4(%rbx), %edx
movl %edx, 0x2c4(%rbx)
movl 0x2cc(%rbx), %ecx
testl %ecx, %ecx
jne 0xbefb
movl 0x2bc(%rbx), %ecx
movl %ecx, 0x2cc(%rbx)
movl 0x294(%rbx), %esi
cmpl $-0x2, %esi
jne 0xbf12
movl 0x290(%rbx), %esi
movl %esi, 0x294(%rbx)
movl 0x28c(%rbx), %edi
testl %edi, %edi
jne 0xbf28
movl 0x288(%rbx), %edi
movl %edi, 0x28c(%rbx)
cmpl $0x5, %edi
je 0xbf41
cmpl $0x10, %edi
jne 0xbf70
movl $0x8, 0x28c(%rbx)
pushq $0x8
popq %rdi
jmp 0xbf70
cmpl $-0x1, 0x2c8(%rbx)
jne 0xbf56
movl 0x2b8(%rbx), %edi
movl %edi, 0x2c8(%rbx)
pushq $0x5
popq %rdi
cmpl $-0x1, 0x2d0(%rbx)
jne 0xbf70
movl 0x2c0(%rbx), %r8d
movl %r8d, 0x2d0(%rbx)
movl 0x2d0(%rbx), %r8d
cmpl $0x186a1, %r8d          # imm = 0x186A1
jb 0xbf89
movl %ecx, 0x2d0(%rbx)
movl %ecx, %r8d
movl 0x2ac(%rbx), %r9d
cmpl $-0x1, %r9d
jne 0xbfa4
movl 0x2a8(%rbx), %r9d
movl %r9d, 0x2ac(%rbx)
cmpl $-0x2, 0x2b48(%rbx)
jne 0xc044
incl %esi
cmpl $0xb, %esi
ja 0xc044
leaq 0x6111(%rip), %r10      # 0x120d4
movslq (%r10,%rsi,4), %rsi
addq %r10, %rsi
jmpq *%rsi
cmpl $0x132657f, %eax        # imm = 0x132657F
ja 0xc013
movl $0x11, 0x12e0(%rbx)
jmp 0xbac3
addl %r9d, %r9d
jmp 0xbff2
xorl %eax, %eax
testl %r9d, %r9d
setne %al
movl %eax, %r9d
incl %ecx
imull %edx, %ecx
addl %r9d, %ecx
incl %r8d
imull 0x2c8(%rbx), %r8d
addl %ecx, %r8d
jmp 0xc03d
movl 0x270(%rbx), %r8d
jmp 0xc03d
leal -0x1(%rdi), %eax
cmpl $0x7, %eax
ja 0xc323
leaq 0x60de(%rip), %rsi      # 0x12104
movslq (%rsi,%rax,4), %rax
addq %rsi, %rax
jmpq *%rax
addl 0x2c8(%rbx), %edx
incl %ecx
imull %edx, %ecx
movl %ecx, %r8d
movl %r8d, 0x2b48(%rbx)
movq %rbx, %rdi
callq 0x6e70
movq 0x2b20(%rbx), %rdi
callq 0x110dc
movq 0x2b20(%rbx), %rdi
movl 0x20(%rdi), %eax
movl %eax, 0x2b40(%rbx)
xorl %eax, %eax
cmpl $0x7d8, 0x250(%rbx)     # imm = 0x7D8
setge %al
leaq 0xc(,%rax,4), %rsi
callq 0x235c
movl 0x250(%rbx), %eax
cmpl $0x7d2, %eax            # imm = 0x7D2
jg 0xc0a9
movq 0x2b20(%rbx), %rdi
movl 0x2b40(%rbx), %esi
callq 0x10d1e
movl 0x250(%rbx), %eax
cmpl $0x7d8, %eax            # imm = 0x7D8
jl 0xc0c2
movl 0x2b40(%rbx), %esi
movq 0x2b20(%rbx), %rdi
callq 0x10e18
movq 0x2b20(%rbx), %rdi
callq 0x110dc
movq 0x2b20(%rbx), %rdi
movl 0x2b40(%rbx), %esi
callq 0x235c
cmpl $-0x1, 0x12a8(%rbx)
jne 0xc0fe
movl 0x12a4(%rbx), %eax
cmpl $-0x1, %eax
pushq $0xa
popq %rcx
cmovnel %eax, %ecx
movl %ecx, 0x12a8(%rbx)
andl $0x0, 0x2b44(%rbx)
movl 0x250(%rbx), %eax
cmpl $0x7d7, %eax            # imm = 0x7D7
jg 0xc11e
cmpl $0x1326580, 0x284(%rbx) # imm = 0x1326580
jb 0xc13d
movq 0x2b20(%rbx), %rdi
movl 0x12b0(%rbx), %esi
callq 0x10d1e
addl $0x4, 0x2b44(%rbx)
movl 0x250(%rbx), %eax
cmpl $0x7d2, %eax            # imm = 0x7D2
jg 0xc163
movq 0x2b20(%rbx), %rdi
movl 0x2a0(%rbx), %esi
callq 0x10d1e
addl $0x4, 0x2b44(%rbx)
movl 0x250(%rbx), %eax
cmpl $0x7d8, %eax            # imm = 0x7D8
jl 0xc183
movl 0x2a0(%rbx), %esi
movq 0x2b20(%rbx), %rdi
callq 0x10e18
addl $0x8, 0x2b44(%rbx)
movq 0x2b20(%rbx), %rdi
movl 0x284(%rbx), %esi
callq 0x10d1e
addl $0x4, 0x2b44(%rbx)
movq 0x2b20(%rbx), %rdi
movl 0x28c(%rbx), %esi
callq 0x10d1e
movl 0x2b44(%rbx), %eax
addl $0x4, %eax
movl %eax, 0x2b44(%rbx)
movl 0x28c(%rbx), %ecx
cmpl $0x2, %ecx
jne 0xc1e2
movq %rbx, %rdi
callq 0x6b5c
addl 0x2b44(%rbx), %eax
movl %eax, 0x2b44(%rbx)
movl 0x28c(%rbx), %ecx
cmpl $0x5, %ecx
jne 0xc201
movq %rbx, %rdi
callq 0x9b48
addl 0x2b44(%rbx), %eax
movl %eax, 0x2b44(%rbx)
movl 0x28c(%rbx), %ecx
cmpl $0x10, %ecx
je 0xc20b
cmpl $0x8, %ecx
jne 0xc273
movl 0x12a8(%rbx), %ecx
cmpl $0x7, %ecx
jg 0xc230
movq %rbx, %rdi
callq 0x9eac
addl 0x2b44(%rbx), %eax
movl %eax, 0x2b44(%rbx)
movl 0x12a8(%rbx), %ecx
movl %ecx, %edx
andl $-0x2, %edx
cmpl $0x8, %edx
jne 0xc254
movq %rbx, %rdi
callq 0xa5d0
addl 0x2b44(%rbx), %eax
movl %eax, 0x2b44(%rbx)
movl 0x12a8(%rbx), %ecx
cmpl $0xa, %ecx
jl 0xc26d
movq %rbx, %rdi
callq 0xad66
addl 0x2b44(%rbx), %eax
movl %eax, 0x2b44(%rbx)
movl 0x28c(%rbx), %ecx
cmpl $0x1, %ecx
jne 0xc292
movq %rbx, %rdi
callq 0xb406
addl 0x2b44(%rbx), %eax
movl %eax, 0x2b44(%rbx)
movl 0x28c(%rbx), %ecx
cmpl $0x6, %ecx
jne 0xc2b1
movq %rbx, %rdi
callq 0xb406
addl 0x2b44(%rbx), %eax
movl %eax, 0x2b44(%rbx)
movl 0x28c(%rbx), %ecx
cmpl $0x3, %ecx
jne 0xc2d0
movq %rbx, %rdi
callq 0xb95e
addl 0x2b44(%rbx), %eax
movl %eax, 0x2b44(%rbx)
movl 0x28c(%rbx), %ecx
cmpl $0x9, %ecx
jne 0xc2ef
movq %rbx, %rdi
callq 0x9a72
addl 0x2b44(%rbx), %eax
movl %eax, 0x2b44(%rbx)
movl 0x28c(%rbx), %ecx
cmpl $0x11, %ecx
jne 0xc308
movq %rbx, %rdi
callq 0x82bc
addl 0x2b44(%rbx), %eax
movl %eax, 0x2b44(%rbx)
movl %eax, 0x2a0(%rbx)
andl $0x0, 0x12e0(%rbx)
movb $0x1, 0x2b29(%rbx)
movb $0x1, %al
jmp 0xbac5
cmpl $0x11, %edi
je 0xc355
cmpl $0x12, %edi
je 0xbac3
jmp 0xc044
incl %ecx
imull %edx, %ecx
movl %ecx, 0x2b48(%rbx)
cmpl $0x9, 0x12a4(%rbx)
jl 0xc044
incl %ecx
jmp 0xc03a
incl %ecx
imull %ecx, %edx
leal (%rdx,%rdx,2), %r8d
jmp 0xc03d
nop