// File: /workspace/github_cpp_makefile_star2_O3/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 0x39fa
movl $0x3, 0x12e0(%rbx)
jmp 0x3a5c
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 0x13592
movq 0x2b18(%rbx), %rdi
cmpl %r15d, 0x8(%rdi)
je 0x3a6f
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 0x133bc
movl 0x248(%rbx), %ecx
movd %ecx, %xmm0
pshufd $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1]
pand 0x1059f(%rip), %xmm0    # 0x14040
movq %xmm0, 0x12e8(%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 0x3b7c
cmpl $0x74656, %eax          # imm = 0x74656
movl $0x7d2, %eax            # imm = 0x7D2
movl $0x7d8, %ecx            # imm = 0x7D8
cmovel %eax, %ecx
movl %ecx, 0x24c(%rbx)
movq 0x2b18(%rbx), %rdi
leaq 0x14(%rsp), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
movl (%r14), %eax
movl %eax, 0x290(%rbx)
incl %eax
cmpl $0xb, %eax
ja 0x3db7
movl $0x8c9, %ecx            # imm = 0x8C9
btl %eax, %ecx
jae 0x3db7
movl 0x24c(%rbx), %eax
cmpl $0x7d2, %eax            # imm = 0x7D2
jg 0x3b53
movq 0x2b18(%rbx), %rdi
leaq 0x270(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movl 0x24c(%rbx), %eax
cmpl $0x7d7, %eax            # imm = 0x7D7
jle 0x3ba4
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
movl $0x8, %edx
callq 0x133bc
movl (%r14), %eax
movl %eax, 0x270(%rbx)
jmp 0x3baa
movb $0x1, %bpl
movb %bpl, 0x2b3c(%rbx)
movq %rbx, %rdi
callq 0x38fc
movl $0x0, 0x12e0(%rbx)
movb %bpl, 0x2b28(%rbx)
jmp 0x3a5e
movl 0x270(%rbx), %eax
testl %eax, %eax
js 0x3bc0
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x2b78(%rbx)
movl 0x24c(%rbx), %eax
cmpl $0x7d2, %eax            # imm = 0x7D2
jg 0x3beb
movq 0x2b18(%rbx), %rdi
leaq 0x298(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movl 0x24c(%rbx), %eax
cmpl $0x7d8, %eax            # imm = 0x7D8
jl 0x3c18
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
movl $0x8, %edx
callq 0x133bc
movl (%r14), %eax
movl %eax, 0x298(%rbx)
movl 0x24c(%rbx), %eax
cmpl $0x7d2, %eax            # imm = 0x7D2
jg 0x3c3d
movq 0x2b18(%rbx), %rdi
leaq 0x29c(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movl 0x24c(%rbx), %eax
cmpl $0x7d8, %eax            # imm = 0x7D8
jl 0x3c64
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
movl $0x8, %edx
callq 0x133bc
movl (%r14), %eax
movl %eax, 0x29c(%rbx)
movl 0x24c(%rbx), %eax
cmpb $0x1, 0x12e4(%rbx)
jne 0x3d0a
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 0x3cc8
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x133bc
incl %r15d
movl 0x298(%rbx), %eax
addl %ebp, %eax
cmpl %eax, %r15d
jb 0x3ca4
cmpl $0x0, 0x29c(%rbx)
je 0x3cf4
xorl %ebp, %ebp
movq %rsp, %r14
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x133bc
incl %ebp
cmpl 0x29c(%rbx), %ebp
jb 0x3cd6
movl $0x0, 0x12e0(%rbx)
movb $0x1, 0x2b28(%rbx)
jmp 0x41a8
cmpl $0x7d8, %eax            # imm = 0x7D8
jl 0x3d2f
movq 0x2b18(%rbx), %rdi
leaq 0x268(%rbx), %rsi
movl $0x8, %edx
callq 0x133bc
movl 0x24c(%rbx), %eax
cmpl $0x7d2, %eax            # imm = 0x7D2
jg 0x3d57
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
movslq (%r14), %rax
movq %rax, 0x268(%rbx)
movl 0x274(%rbx), %ebp
testl %ebp, %ebp
jne 0x3dd0
movq 0x2b18(%rbx), %rdi
movq 0x20(%rdi), %r14
movq %rsp, %r15
movq %r15, %rsi
movl $0x4, %edx
callq 0x133bc
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 0x3dc6
movl $0x1, 0x8(%r15)
jmp 0x3dca
movl $0x8, 0x12e0(%rbx)
jmp 0x432d
movq %r14, 0x20(%r15)
movl 0x274(%rbx), %ebp
movl %ebp, 0x278(%rbx)
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movl $0x4, %edx
callq 0x133bc
cmpl $0x7d5, %ebp            # imm = 0x7D5
jl 0x3e2d
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
movl (%r14), %eax
movq %rax, 0x220(%rbx)
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
jmp 0x3e38
movl 0x10(%rsp), %eax
movq %rax, 0x220(%rbx)
movl 0x274(%rbx), %ebp
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movl $0x4, %edx
callq 0x133bc
cmpl $0x7d5, %ebp            # imm = 0x7D5
jl 0x3e95
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
movl (%r14), %eax
movq %rax, 0x228(%rbx)
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
jmp 0x3ea0
movl 0x10(%rsp), %eax
movq %rax, 0x228(%rbx)
movq 0x2b18(%rbx), %rdi
movq %rbx, %rsi
callq 0x24c1
movq 0x2b18(%rbx), %rdi
leaq 0x20(%rbx), %rsi
callq 0x24c1
movq 0x2b18(%rbx), %rdi
leaq 0x60(%rbx), %r14
movq %r14, %rsi
callq 0x24c1
leaq 0x80(%rbx), %rdi
movq %r14, %rsi
callq 0x20a0
cmpl $0x0, 0x12f0(%rbx)
je 0x3fef
movq 0x2b18(%rbx), %rdi
leaq 0x12f4(%rbx), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
movslq 0x12f4(%rbx), %r12
leaq (,%r12,8), %r15
testq %r12, %r12
movq $-0x1, %rdi
cmovnsq %r15, %rdi
callq 0x2030
movq %rax, 0x1300(%rbx)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20b0
testq %r12, %r12
jle 0x3fef
xorl %r13d, %r13d
movq %rsp, %r15
leaq 0xc(%rsp), %r12
movq 0x2b18(%rbx), %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x133bc
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 0x3fe0
movq 0x2b18(%rbx), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x133bc
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 0x3fa9
incq %r13
movslq (%r14), %rax
cmpq %rax, %r13
jl 0x3f53
cmpl $0x0, 0x12ec(%rbx)
je 0x40fd
movq 0x2b18(%rbx), %rdi
leaq 0x1310(%rbx), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
movslq 0x1310(%rbx), %r12
leaq (,%r12,8), %r15
testq %r12, %r12
movq $-0x1, %rdi
cmovnsq %r15, %rdi
callq 0x2030
movq %rax, 0x1318(%rbx)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20b0
testq %r12, %r12
jle 0x40fd
xorl %r13d, %r13d
movq %rsp, %r15
leaq 0xc(%rsp), %r12
movq 0x2b18(%rbx), %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x133bc
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 0x40ee
movq 0x2b18(%rbx), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x133bc
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 0x40b7
incq %r13
movslq (%r14), %rax
cmpq %rax, %r13
jl 0x4061
cmpl $0x0, 0x29c(%rbx)
je 0x4197
movq 0x2b18(%rbx), %rdi
movl 0x298(%rbx), %eax
cmpl 0x20(%rdi), %eax
jne 0x4197
movl 0x24c(%rbx), %eax
xorl %ebp, %ebp
cmpl $0x7d8, %eax            # imm = 0x7D8
jl 0x4147
leaq 0x12b0(%rbx), %rsi
movl $0x4, %ebp
movl $0x4, %edx
callq 0x133bc
movl 0x24c(%rbx), %eax
cmpl $0x7d2, %eax            # imm = 0x7D2
jg 0x416d
movq 0x2b18(%rbx), %rdi
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
callq 0x133bc
addl $0x4, %ebp
movl 0x24c(%rbx), %eax
cmpl $0x7d7, %eax            # imm = 0x7D7
jle 0x41b0
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
movl $0x8, %edx
callq 0x133bc
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addl $0x8, %ebp
jmp 0x41b4
movl $0x6, 0x12e0(%rbx)
movb $0x0, 0x2b28(%rbx)
movb $0x1, %bpl
jmp 0x3a5e
movl 0xc(%rsp), %eax
cmpl 0x29c(%rbx), %eax
jne 0x4323
movq 0x2b18(%rbx), %rdi
leaq 0x280(%rbx), %r14
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x288(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movl 0x288(%rbx), %eax
cmpl $0x12, %eax
ja 0x4354
addl $0x8, %ebp
movl $0x7036a, %ecx          # imm = 0x7036A
btl %eax, %ecx
jae 0x433a
cmpl $0x5, %eax
jne 0x4228
movq %rbx, %rdi
callq 0x4a40
addl %eax, %ebp
movl 0x288(%rbx), %eax
cmpl $0x10, %eax
je 0x4232
cmpl $0x8, %eax
jne 0x4244
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5492
addl %eax, %ebp
movl 0x288(%rbx), %eax
cmpl $0x6, %eax
je 0x424e
cmpl $0x1, %eax
jne 0x425e
movq %rbx, %rdi
callq 0x62e0
addl %eax, %ebp
movl 0x288(%rbx), %eax
cmpl $0x3, %eax
jne 0x4273
movq %rbx, %rdi
callq 0x6aa8
addl %eax, %ebp
movl 0x288(%rbx), %eax
cmpl $0x9, %eax
jne 0x4288
movq %rbx, %rdi
callq 0x6c66
addl %eax, %ebp
movl 0x288(%rbx), %eax
cmpl $0x11, %eax
jne 0x429d
movq %rbx, %rdi
callq 0x6e0c
addl %eax, %ebp
movl 0x288(%rbx), %eax
cmpl $0x12, %eax
jne 0x42ac
movq %rbx, %rdi
callq 0x6f36
addl %eax, %ebp
movl 0x29c(%rbx), %eax
cmpl %ebp, %eax
jne 0x42c2
movl 0x290(%rbx), %ecx
cmpl 0x14(%rsp), %ecx
je 0x42e0
movl 0x288(%rbx), %ecx
movl %ecx, %esi
xorl $0x2, %esi
movl 0x12a4(%rbx), %edx
movl %edx, %edi
xorl $0x8, %edi
orl %esi, %edi
jne 0x4304
movl 0x14(%rsp), %ecx
cmpl $-0x1, %ecx
je 0x3cf4
movl 0x290(%rbx), %eax
cmpl $0xa, %eax
ja 0x4323
movl $0x464, %ecx            # imm = 0x464
btl %eax, %ecx
jb 0x3cf4
jmp 0x4323
cmpl $0x7, %edx
jne 0x4323
cmpl $0x6, %ecx
je 0x4313
cmpl $0x1, %ecx
jne 0x4323
cmpl $0x186a1, %eax          # imm = 0x186A1
jb 0x4323
cmpl $0x132677b, (%r14)      # imm = 0x132677B
je 0x42dc
movl $0x6, 0x12e0(%rbx)
movq %rbx, %rdi
callq 0x3596
jmp 0x3a5c
cmpl $0x2, %eax
jne 0x4354
movq %rbx, %rdi
callq 0x4360
addl %eax, %ebp
movl 0x288(%rbx), %eax
jmp 0x4213
movl $0x7, 0x12e0(%rbx)
jmp 0x432d