// File: /workspace/github_cpp_makefile_star2_O1/NichtJens[P]lmf2txt/LMF_IO.cpp
// Function: LMF_IO::OpenInputLMF(char*)
bool LMF_IO::OpenInputLMF(__int8 * LMF_Filename)
/////////////////////////////////////////////////////////////////
{
	unsigned __int32	unsigned_int_Dummy;
	__int32				data_format_in_header;
	__int8				byte_Dummy;
	__int32				byte_counter;

	if (InputFileIsOpen) {
		errorflag = 3; // file is already open
		return false;
	}
	input_lmf = new MyFILE(true);

	TDC8HP.UserHeaderVersion = 0; // yes, 0 is ok here and 2 in LMF_IO::initialization is also ok

	input_lmf->open(LMF_Filename);

	if (input_lmf->error) {
		errorflag = 4; // could not open file
		input_lmf = 0;
		return false;
	}

//L10:

//  READ LMF-HEADER
	ArchiveFlag = 0;

	*input_lmf >> ArchiveFlag;

	DAQ_SOURCE_CODE_bitmasked  =  ArchiveFlag & DAQ_SOURCE_CODE;
	DAN_SOURCE_CODE_bitmasked  =  ArchiveFlag & DAN_SOURCE_CODE;
	CCF_HISTORY_CODE_bitmasked =  ArchiveFlag & CCF_HISTORY_CODE;

	ArchiveFlag = ArchiveFlag & 0x1fffffff;
	
	if (ArchiveFlag != 476758 && ArchiveFlag != 476759) { // is this not a Cobold list mode file?
		not_Cobold_LMF = true;
		if (!OpenNonCoboldFile()) return false;
		errorflag = 0; // no error
		InputFileIsOpen = true;
		return true;
	}

	if (ArchiveFlag == 476758) Cobold_Header_version = 2002;
	if (ArchiveFlag == 476759) Cobold_Header_version = 2008;

	*input_lmf >> data_format_in_header;

	data_format_in_userheader = data_format_in_header;
	if (data_format_in_header != LM_USERDEF && data_format_in_header != LM_SHORT && data_format_in_header != LM_SLONG && data_format_in_header != LM_DOUBLE && data_format_in_header != LM_CAMAC) {
		errorflag = 8;
		CloseInputLMF();
		return false;
	}

	if (Cobold_Header_version <= 2002)	*input_lmf >> Numberofcoordinates;
	if (Cobold_Header_version >= 2008)	{
		unsigned __int64 temp;
		*input_lmf >> temp;
		Numberofcoordinates =__int32(temp);
	}
	
	if (Numberofcoordinates >= 0) CAMAC_Data = new unsigned __int32[Numberofcoordinates];

	if (Cobold_Header_version <= 2002)	*input_lmf >> Headersize;
	if (Cobold_Header_version >= 2008)	{
		unsigned __int64 temp;
		*input_lmf >> temp;
		Headersize =__int32(temp);
	}


	if (Cobold_Header_version <= 2002)	*input_lmf >> User_header_size;
	if (Cobold_Header_version >= 2008)	{
		unsigned __int64 temp;
		*input_lmf >> temp;
		User_header_size =__int32(temp);
	}

	if (skip_header) {
		__int32 backstep;
		if (Cobold_Header_version <= 2002) backstep = sizeof(__int32)*5;
		if (Cobold_Header_version >= 2008) backstep = sizeof(__int32)*2 + sizeof(__int64)*3;
		for (unsigned __int32 i=0;i<Headersize-backstep;++i) *input_lmf >> byte_Dummy;
		for (unsigned __int32 i=0;i<User_header_size;++i) *input_lmf >> byte_Dummy;
		errorflag = 0; // no error
		InputFileIsOpen = true;
		goto L666;
	}

	if (Cobold_Header_version >= 2008) *input_lmf >> uint64_Numberofevents;
	if (Cobold_Header_version <= 2002) {
		__int32 temp;
		*input_lmf >> temp;
		uint64_Numberofevents = temp;
	}

	// get CTime version:
	if (!CTime_version) {
		unsigned __int32 dummy_uint32;
		unsigned __int64 pos = input_lmf->tell(); 
		*input_lmf >> dummy_uint32;
		if (dummy_uint32 == (unsigned) INT_MIN_ + 10) CTime_version = 2005; else CTime_version = 2003;
		input_lmf->seek(pos);
	}
	
	CTime_version_output = CTime_version;

	unsigned __int32 dummy_uint32;
	if(CTime_version >= 2005) {
		*input_lmf >> dummy_uint32;
		*input_lmf >> dummy_uint32; Starttime = dummy_uint32;
		*input_lmf >> dummy_uint32;
	} else {*input_lmf >> dummy_uint32; Starttime = dummy_uint32;}

	if(CTime_version >= 2005) {
		*input_lmf >> dummy_uint32;
		*input_lmf >> dummy_uint32; Stoptime = dummy_uint32;
		*input_lmf >> dummy_uint32;
	} else {
		*input_lmf >> dummy_uint32; Stoptime = dummy_uint32;
	}

	Read_CString_as_StdString(*input_lmf,Versionstring);
	Read_CString_as_StdString(*input_lmf,FilePathName);
	Read_CString_as_StdString(*input_lmf,Comment);
	Comment_output = Comment;

	byte_counter = 0;

	if (CCF_HISTORY_CODE_bitmasked) {
		*input_lmf >> number_of_CCFHistory_strings;
		CCFHistory_strings = new std::string*[number_of_CCFHistory_strings];
		memset(CCFHistory_strings,0,sizeof(std::string*)*number_of_CCFHistory_strings);
		for (__int32 i=0;i<number_of_CCFHistory_strings;++i) {
			__int32 string_len;
			*input_lmf >> string_len;
			CCFHistory_strings[i] = new std::string();
			CCFHistory_strings[i]->reserve(string_len);
			while (string_len > 0) {
				__int8 c;
				*input_lmf >> c;	
				*CCFHistory_strings[i] += c;
				--string_len;
			}
		}
	}

	if (DAN_SOURCE_CODE_bitmasked) {
		*input_lmf >> number_of_DAN_source_strings;
		DAN_source_strings = new std::string*[number_of_DAN_source_strings];
		memset(DAN_source_strings,0,sizeof(std::string*)*number_of_DAN_source_strings);
		for (__int32 i=0;i<number_of_DAN_source_strings;++i) {
			__int32 string_len;
			*input_lmf >> string_len;
			DAN_source_strings[i] = new std::string();
			DAN_source_strings[i]->reserve(string_len);
			while (string_len > 0) {
				__int8 c;
				*input_lmf >> c; 
				*DAN_source_strings[i] += c;
				--string_len;
			}
		}
	}	



	if (User_header_size == 0) {
		errorflag = 6;
		InputFileIsOpen = false;
		goto L666;
	}

	if ((unsigned) __int32(input_lmf->tell()) != Headersize) {
		errorflag = 6;
		InputFileIsOpen = false;
		goto L666;
	}



//  READ USER-HEADER
	if (Cobold_Header_version >= 2008) {
		*input_lmf >> LMF_Header_version;   byte_counter += sizeof(__int32);
	}

	if (Cobold_Header_version <= 2002) {*input_lmf >> unsigned_int_Dummy;	byte_counter += sizeof(__int32);}

	if (Cobold_Header_version >= 2008) {
		unsigned __int64 temp;
		*input_lmf >> temp;	unsigned_int_Dummy = (unsigned __int32)(temp);
		byte_counter += sizeof(unsigned __int64);
	}


	if (unsigned_int_Dummy != User_header_size) {
		errorflag = 6; // error reading header
		CloseInputLMF();
		return false;
	}

	*input_lmf >> DAQVersion;	byte_counter += sizeof(__int32);	// Version is always 2nd value

	*input_lmf >> DAQ_ID;		byte_counter += sizeof(__int32);	// DAQ_ID is always 3ed value

	if (DAQ_ID == DAQ_ID_TDC8)		goto L100;
	if (DAQ_ID == DAQ_ID_2TDC8)		goto L100;
	if (DAQ_ID == DAQ_ID_TDC8HP)	goto L100;
	if (DAQ_ID == DAQ_ID_TDC8HPRAW)	goto L100;
	if (DAQ_ID == DAQ_ID_HM1)		goto L100;
	if (DAQ_ID == DAQ_ID_CAMAC)		goto L100;
	if (DAQ_ID == DAQ_ID_HM1_ABM)	goto L100;
	if (DAQ_ID == DAQ_ID_TCPIP)		goto L100;
	if (DAQ_ID == DAQ_ID_FADC8)		goto L100;
	if (DAQ_ID == DAQ_ID_FADC4)		goto L100;

	errorflag = 7; // LMF not data of TDC8PCI2 or 2TDC8PCI2 or TDC8HP or CAMAC or HM1 or TCPIP
	CloseInputLMF();
	return false;

L100:
	if (DAQ_ID == DAQ_ID_TDC8)	 byte_counter += ReadTDC8PCI2Header();
	if (DAQ_ID == DAQ_ID_2TDC8)	 byte_counter += Read2TDC8PCI2Header();
	if (DAQ_ID == DAQ_ID_TDC8HP || DAQ_ID == DAQ_ID_TDC8HPRAW) byte_counter += ReadTDC8HPHeader_LMFV_1_to_7(byte_counter);
	if (DAQ_ID == DAQ_ID_HM1 || DAQ_ID == DAQ_ID_HM1_ABM)     byte_counter += ReadHM1Header();
	if (DAQ_ID == DAQ_ID_CAMAC)  byte_counter += ReadCAMACHeader();
	if (DAQ_ID == DAQ_ID_TCPIP)  byte_counter += ReadTCPIPHeader();
	if (DAQ_ID == DAQ_ID_FADC8)  byte_counter += ReadfADC8Header();
	if (DAQ_ID == DAQ_ID_FADC4)  byte_counter += ReadfADC4Header_up_to_v11();

	if ((User_header_size != (unsigned) byte_counter) || (data_format_in_userheader != data_format_in_header)) {
		if (!(DAQ_ID == DAQ_ID_TDC8 && this->LMF_Version == 0x8)
			&& !(this->LMF_Version == 7 && (DAQ_ID == DAQ_ID_HM1 || DAQ_ID == DAQ_ID_HM1_ABM) && DAQVersion == 20080507 && User_header_size > 100000)) {
			errorflag = 6; // error reading header
			CloseInputLMF();
			return false;
		}
	}

	if (data_format_in_header != LM_USERDEF && data_format_in_userheader != LM_SHORT && data_format_in_userheader != LM_SLONG && data_format_in_userheader != LM_DOUBLE && data_format_in_userheader != LM_CAMAC) {
		errorflag = 6; // error reading header
		CloseInputLMF();
		return false;
	}

	errorflag = 0; // no error
	InputFileIsOpen = true;

L666:

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpb $0x1, 0x2b28(%rdi)
jne 0x395c
movl $0x3, 0x12e0(%rbx)
jmp 0x39be
movq %rsi, %r14
movl $0x28, %edi
callq 0x2130
xorl %r15d, %r15d
movl %r15d, 0x8(%rax)
movb $0x0, 0xc(%rax)
movb $0x1, 0x18(%rax)
movq %r15, (%rax)
movq %r15, 0x20(%rax)
movq %r15, 0x10(%rax)
movq %rax, 0x2b18(%rbx)
movl %r15d, 0x14dc(%rbx)
movq %rax, %rdi
movq %r14, %rsi
callq 0x13bba
movq 0x2b18(%rbx), %rdi
cmpl %r15d, 0x8(%rdi)
je 0x39d1
movl $0x4, 0x12e0(%rbx)
movq $0x0, 0x2b18(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x248(%rbx), %rsi
movl $0x0, 0x248(%rbx)
movl $0x4, %edx
callq 0x139ac
movl 0x248(%rbx), %ecx
movl %ecx, %eax
andl $0x80000000, %eax       # imm = 0x80000000
movl %eax, 0x12e8(%rbx)
movl %ecx, %eax
andl $0x40000000, %eax       # imm = 0x40000000
movl %eax, 0x12ec(%rbx)
movl %ecx, %eax
andl $0x20000000, %eax       # imm = 0x20000000
movl %eax, 0x12f0(%rbx)
movl %ecx, %eax
andl $0x1fffffff, %eax       # imm = 0x1FFFFFFF
movl %eax, 0x248(%rbx)
andl $0x1ffffffe, %ecx       # imm = 0x1FFFFFFE
cmpl $0x74656, %ecx          # imm = 0x74656
jne 0x3a49
cmpl $0x74656, %eax          # imm = 0x74656
je 0x3a71
cmpl $0x74657, %eax          # imm = 0x74657
jne 0x3a7c
movl $0x7d8, %eax            # imm = 0x7D8
jmp 0x3a76
movb $0x1, %bpl
movb %bpl, 0x2b3c(%rbx)
movq %rbx, %rdi
callq 0x385e
movl $0x0, 0x12e0(%rbx)
movb %bpl, 0x2b28(%rbx)
jmp 0x39c0
movl $0x7d2, %eax            # imm = 0x7D2
movl %eax, 0x24c(%rbx)
movq 0x2b18(%rbx), %rdi
leaq 0x14(%rsp), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x139ac
movl (%r14), %eax
movl %eax, 0x290(%rbx)
incl %eax
cmpl $0xb, %eax
ja 0x3d14
movl $0x8c9, %ecx            # imm = 0x8C9
btl %eax, %ecx
jae 0x3d14
cmpl $0x7d2, 0x24c(%rbx)     # imm = 0x7D2
jg 0x3adb
movq 0x2b18(%rbx), %rdi
leaq 0x270(%rbx), %rsi
movl $0x4, %edx
callq 0x139ac
cmpl $0x7d8, 0x24c(%rbx)     # imm = 0x7D8
jl 0x3b07
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
movl $0x8, %edx
callq 0x139ac
movl (%r14), %eax
movl %eax, 0x270(%rbx)
movslq 0x270(%rbx), %rdi
testq %rdi, %rdi
js 0x3b23
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x2b78(%rbx)
cmpl $0x7d2, 0x24c(%rbx)     # imm = 0x7D2
jg 0x3b47
movq 0x2b18(%rbx), %rdi
leaq 0x298(%rbx), %rsi
movl $0x4, %edx
callq 0x139ac
cmpl $0x7d8, 0x24c(%rbx)     # imm = 0x7D8
jl 0x3b73
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
movl $0x8, %edx
callq 0x139ac
movl (%r14), %eax
movl %eax, 0x298(%rbx)
cmpl $0x7d2, 0x24c(%rbx)     # imm = 0x7D2
jg 0x3b97
movq 0x2b18(%rbx), %rdi
leaq 0x29c(%rbx), %rsi
movl $0x4, %edx
callq 0x139ac
cmpl $0x7d8, 0x24c(%rbx)     # imm = 0x7D8
jl 0x3bc3
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
movl $0x8, %edx
callq 0x139ac
movl (%r14), %eax
movl %eax, 0x29c(%rbx)
movl 0x24c(%rbx), %eax
cmpb $0x1, 0x12e4(%rbx)
jne 0x3c69
cmpl $0x7d8, %eax            # imm = 0x7D8
movl $0x20, %eax
movl $0x14, %ecx
cmovgel %eax, %ecx
movl $0xffffffe0, %eax       # imm = 0xFFFFFFE0
movl $0xffffffec, %ebp       # imm = 0xFFFFFFEC
cmovgel %eax, %ebp
cmpl %ecx, 0x298(%rbx)
je 0x3c27
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x139ac
incl %r15d
movl 0x298(%rbx), %eax
addl %ebp, %eax
cmpl %eax, %r15d
jb 0x3c03
cmpl $0x0, 0x29c(%rbx)
je 0x3c53
xorl %ebp, %ebp
movq %rsp, %r14
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x139ac
incl %ebp
cmpl 0x29c(%rbx), %ebp
jb 0x3c35
movl $0x0, 0x12e0(%rbx)
movb $0x1, 0x2b28(%rbx)
jmp 0x4248
cmpl $0x7d8, %eax            # imm = 0x7D8
jl 0x3c88
movq 0x2b18(%rbx), %rdi
leaq 0x268(%rbx), %rsi
movl $0x8, %edx
callq 0x139ac
cmpl $0x7d2, 0x24c(%rbx)     # imm = 0x7D2
jg 0x3cb5
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x139ac
movslq (%r14), %rax
movq %rax, 0x268(%rbx)
cmpl $0x0, 0x274(%rbx)
jne 0x3d27
movq 0x2b18(%rbx), %rdi
movq 0x20(%rdi), %r14
movq %rsp, %r15
movq %r15, %rsi
movl $0x4, %edx
callq 0x139ac
xorl %eax, %eax
cmpl $0x8000000a, (%r15)     # imm = 0x8000000A
sete %al
leal 0x7d3(,%rax,2), %eax
movl %eax, 0x274(%rbx)
movq 0x2b18(%rbx), %r15
movq (%r15), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x20c0
testl %eax, %eax
je 0x3d23
movl $0x1, 0x8(%r15)
jmp 0x3d27
movl $0x8, 0x12e0(%rbx)
jmp 0x4279
movq %r14, 0x20(%r15)
movl 0x274(%rbx), %ebp
movl %ebp, 0x278(%rbx)
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movl $0x4, %edx
callq 0x139ac
cmpl $0x7d5, %ebp            # imm = 0x7D5
jl 0x3d8a
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x139ac
movl (%r14), %eax
movq %rax, 0x220(%rbx)
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x139ac
jmp 0x3d95
movl 0x10(%rsp), %eax
movq %rax, 0x220(%rbx)
movl 0x274(%rbx), %ebp
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movl $0x4, %edx
callq 0x139ac
cmpl $0x7d5, %ebp            # imm = 0x7D5
jl 0x3df2
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x139ac
movl (%r14), %eax
movq %rax, 0x228(%rbx)
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x139ac
jmp 0x3dfd
movl 0x10(%rsp), %eax
movq %rax, 0x228(%rbx)
movq 0x2b18(%rbx), %rdi
movq %rbx, %rsi
callq 0x24b8
movq 0x2b18(%rbx), %rdi
leaq 0x20(%rbx), %rsi
callq 0x24b8
movq 0x2b18(%rbx), %rdi
leaq 0x60(%rbx), %r14
movq %r14, %rsi
callq 0x24b8
leaq 0x80(%rbx), %rdi
movq %r14, %rsi
callq 0x20a0
cmpl $0x0, 0x12f0(%rbx)
je 0x3f50
movq 0x2b18(%rbx), %rdi
leaq 0x12f4(%rbx), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x139ac
movslq 0x12f4(%rbx), %rax
leaq (,%rax,8), %r15
testq %rax, %rax
movq $-0x1, %rdi
cmovnsq %r15, %rdi
callq 0x2030
movq %rax, 0x1300(%rbx)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20b0
cmpl $0x0, 0x12f4(%rbx)
jle 0x3f50
xorl %r13d, %r13d
movq %rsp, %r15
leaq 0xc(%rsp), %r12
movq 0x2b18(%rbx), %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x139ac
movl $0x20, %edi
callq 0x2130
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x1300(%rbx), %rcx
movq %rax, (%rcx,%r13,8)
movq 0x1300(%rbx), %rax
movq (%rax,%r13,8), %rdi
movslq (%rsp), %rsi
callq 0x2210
cmpl $0x0, (%rsp)
jle 0x3f41
movq 0x2b18(%rbx), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x139ac
movsbl 0xc(%rsp), %esi
movq 0x1300(%rbx), %rax
movq (%rax,%r13,8), %rdi
callq 0x20f0
movl (%rsp), %eax
leal -0x1(%rax), %ecx
movl %ecx, (%rsp)
cmpl $0x1, %eax
jg 0x3f0a
incq %r13
movslq (%r14), %rax
cmpq %rax, %r13
jl 0x3eb4
cmpl $0x0, 0x12ec(%rbx)
je 0x4062
movq 0x2b18(%rbx), %rdi
leaq 0x1310(%rbx), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x139ac
movslq 0x1310(%rbx), %rax
leaq (,%rax,8), %r15
testq %rax, %rax
movq $-0x1, %rdi
cmovnsq %r15, %rdi
callq 0x2030
movq %rax, 0x1318(%rbx)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20b0
cmpl $0x0, 0x1310(%rbx)
jle 0x4062
xorl %r13d, %r13d
movq %rsp, %r15
leaq 0xc(%rsp), %r12
movq 0x2b18(%rbx), %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x139ac
movl $0x20, %edi
callq 0x2130
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x1318(%rbx), %rcx
movq %rax, (%rcx,%r13,8)
movq 0x1318(%rbx), %rax
movq (%rax,%r13,8), %rdi
movslq (%rsp), %rsi
callq 0x2210
cmpl $0x0, (%rsp)
jle 0x4053
movq 0x2b18(%rbx), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x139ac
movsbl 0xc(%rsp), %esi
movq 0x1318(%rbx), %rax
movq (%rax,%r13,8), %rdi
callq 0x20f0
movl (%rsp), %eax
leal -0x1(%rax), %ecx
movl %ecx, (%rsp)
cmpl $0x1, %eax
jg 0x401c
incq %r13
movslq (%r14), %rax
cmpq %rax, %r13
jl 0x3fc6
cmpl $0x0, 0x29c(%rbx)
je 0x4237
movq 0x2b18(%rbx), %rdi
movl 0x298(%rbx), %eax
cmpl 0x20(%rdi), %eax
jne 0x4237
xorl %ebp, %ebp
cmpl $0x7d8, 0x24c(%rbx)     # imm = 0x7D8
jl 0x40a9
leaq 0x12b0(%rbx), %rsi
movl $0x4, %ebp
movl $0x4, %edx
callq 0x139ac
cmpl $0x7d2, 0x24c(%rbx)     # imm = 0x7D2
jg 0x40ce
movq 0x2b18(%rbx), %rdi
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
callq 0x139ac
addl $0x4, %ebp
cmpl $0x7d8, 0x24c(%rbx)     # imm = 0x7D8
jl 0x40fb
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
movl $0x8, %edx
callq 0x139ac
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addl $0x8, %ebp
movl 0xc(%rsp), %eax
cmpl 0x29c(%rbx), %eax
jne 0x426f
movq 0x2b18(%rbx), %rdi
leaq 0x280(%rbx), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x139ac
movq 0x2b18(%rbx), %rdi
leaq 0x288(%rbx), %r15
movq %r15, %rsi
movl $0x4, %edx
callq 0x139ac
movl 0x288(%rbx), %eax
cmpl $0x12, %eax
ja 0x429a
addl $0x8, %ebp
movl $0x7036a, %ecx          # imm = 0x7036A
btl %eax, %ecx
jae 0x4286
cmpl $0x5, (%r15)
jne 0x4171
movq %rbx, %rdi
callq 0x497a
addl %eax, %ebp
movl (%r15), %eax
cmpl $0x10, %eax
je 0x417e
cmpl $0x8, %eax
jne 0x418a
movq %rbx, %rdi
movl %ebp, %esi
callq 0x53fa
addl %eax, %ebp
movl (%r15), %eax
cmpl $0x6, %eax
je 0x4197
cmpl $0x1, %eax
jne 0x41a1
movq %rbx, %rdi
callq 0x64ae
addl %eax, %ebp
cmpl $0x3, (%r15)
jne 0x41b1
movq %rbx, %rdi
callq 0x6c72
addl %eax, %ebp
cmpl $0x9, (%r15)
jne 0x41c1
movq %rbx, %rdi
callq 0x6e30
addl %eax, %ebp
cmpl $0x11, (%r15)
jne 0x41d1
movq %rbx, %rdi
callq 0x6fd6
addl %eax, %ebp
cmpl $0x12, (%r15)
jne 0x41e1
movq %rbx, %rdi
callq 0x70fc
addl %eax, %ebp
movl 0x29c(%rbx), %eax
cmpl %ebp, %eax
jne 0x41f7
movl 0x290(%rbx), %ecx
cmpl 0x14(%rsp), %ecx
je 0x4211
movl 0x288(%rbx), %ecx
movl %ecx, %esi
xorl $0x2, %esi
movl 0x12a4(%rbx), %edx
movl %edx, %edi
xorl $0x8, %edi
orl %esi, %edi
jne 0x4250
cmpl $-0x1, 0x14(%rsp)
je 0x3c53
movl 0x290(%rbx), %eax
cmpl $0xa, %eax
ja 0x426f
movl $0x464, %ecx            # imm = 0x464
btl %eax, %ecx
jb 0x3c53
jmp 0x426f
movl $0x6, 0x12e0(%rbx)
movb $0x0, 0x2b28(%rbx)
movb $0x1, %bpl
jmp 0x39c0
cmpl $0x7, %edx
jne 0x426f
cmpl $0x6, %ecx
je 0x425f
cmpl $0x1, %ecx
jne 0x426f
cmpl $0x186a1, %eax          # imm = 0x186A1
jb 0x426f
cmpl $0x132677b, (%r14)      # imm = 0x132677B
je 0x4211
movl $0x6, 0x12e0(%rbx)
movq %rbx, %rdi
callq 0x356a
jmp 0x39be
cmpl $0x2, %eax
jne 0x429a
movq %rbx, %rdi
callq 0x42a6
addl %eax, %ebp
jmp 0x4161
movl $0x7, 0x12e0(%rbx)
jmp 0x4279