// File: /workspace/github_cpp_makefile_star2_O2/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 0x34a2
movl $0x3, 0x12e0(%rbx)
jmp 0x3500
movq %rsi, %r14
pushq $0x28
popq %rdi
callq 0x2130
andl $0x0, 0x8(%rax)
movb $0x0, 0xc(%rax)
movb $0x1, 0x18(%rax)
andq $0x0, (%rax)
andq $0x0, 0x20(%rax)
andq $0x0, 0x10(%rax)
movq %rax, 0x2b18(%rbx)
andl $0x0, 0x14dc(%rbx)
movq %rax, %rdi
movq %r14, %rsi
callq 0x10fdc
movq 0x2b18(%rbx), %rdi
xorl %eax, %eax
cmpl %eax, 0x8(%rdi)
je 0x3513
movl $0x4, 0x12e0(%rbx)
andq $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
andl $0x0, 0x248(%rbx)
callq 0x10d66
movl 0x248(%rbx), %ecx
movd %ecx, %xmm0
pshufd $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1]
pand 0xeb03(%rip), %xmm0     # 0x12040
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 0x3609
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
callq 0x10fca
movl (%r14), %eax
movl %eax, 0x290(%rbx)
incl %eax
cmpl $0xb, %eax
ja 0x3b4d
movl $0x8c9, %ecx            # imm = 0x8C9
btl %eax, %ecx
jae 0x3b4d
movl 0x24c(%rbx), %eax
cmpl $0x7d2, %eax            # imm = 0x7D2
jg 0x35e5
movq 0x2b18(%rbx), %rdi
leaq 0x270(%rbx), %rsi
callq 0x10fca
movl 0x24c(%rbx), %eax
cmpl $0x7d7, %eax            # imm = 0x7D7
jle 0x362e
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x10d78
movl (%r14), %eax
movl %eax, 0x270(%rbx)
jmp 0x3634
movb $0x1, %bpl
movb %bpl, 0x2b3c(%rbx)
movq %rbx, %rdi
callq 0x33ce
andl $0x0, 0x12e0(%rbx)
movb %bpl, 0x2b28(%rbx)
jmp 0x3502
movl 0x270(%rbx), %eax
testl %eax, %eax
js 0x364a
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, 0x2b78(%rbx)
movl 0x24c(%rbx), %eax
cmpl $0x7d2, %eax            # imm = 0x7D2
jg 0x3670
movq 0x2b18(%rbx), %rdi
leaq 0x298(%rbx), %rsi
callq 0x10d66
movl 0x24c(%rbx), %eax
cmpl $0x7d8, %eax            # imm = 0x7D8
jl 0x3698
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x10d78
movl (%r14), %eax
movl %eax, 0x298(%rbx)
movl 0x24c(%rbx), %eax
cmpl $0x7d2, %eax            # imm = 0x7D2
jg 0x36b8
movq 0x2b18(%rbx), %rdi
leaq 0x29c(%rbx), %rsi
callq 0x10d66
movl 0x24c(%rbx), %eax
cmpl $0x7d8, %eax            # imm = 0x7D8
jl 0x36da
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x10d78
movl (%r14), %eax
movl %eax, 0x29c(%rbx)
movl 0x24c(%rbx), %eax
cmpb $0x1, 0x12e4(%rbx)
jne 0x3722
cmpl $0x7d8, %eax            # imm = 0x7D8
pushq $-0x20
popq %rax
pushq $-0x14
popq %rbp
cmovgel %eax, %ebp
xorl %r15d, %r15d
movq %rsp, %r14
movl 0x298(%rbx), %eax
addl %ebp, %eax
cmpl %eax, %r15d
jae 0x3801
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
callq 0x11060
incl %r15d
jmp 0x36fd
cmpl $0x7d8, %eax            # imm = 0x7D8
jl 0x3742
movq 0x2b18(%rbx), %rdi
leaq 0x268(%rbx), %rsi
callq 0x10d78
movl 0x24c(%rbx), %eax
cmpl $0x7d2, %eax            # imm = 0x7D2
jg 0x3765
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x10fca
movslq (%r14), %rax
movq %rax, 0x268(%rbx)
movl 0x274(%rbx), %ebp
testl %ebp, %ebp
jne 0x37b3
movq 0x2b18(%rbx), %rdi
movq 0x20(%rdi), %r14
movq %rsp, %r15
movq %r15, %rsi
callq 0x10d66
xorl %eax, %eax
cmpl $0x8000000a, (%r15)     # imm = 0x8000000A
sete %al
leal 0x7d3(,%rax,2), %eax
movl %eax, 0x274(%rbx)
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
callq 0x235c
movl 0x274(%rbx), %ebp
movl %ebp, 0x278(%rbx)
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0x10d66
cmpl $0x7d5, %ebp            # imm = 0x7D5
jl 0x3825
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x10d66
movl (%r14), %eax
movq %rax, 0x220(%rbx)
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
callq 0x10d66
jmp 0x3830
xorl %ebp, %ebp
movq %rsp, %r14
cmpl 0x29c(%rbx), %ebp
jae 0x3c9c
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
callq 0x11060
incl %ebp
jmp 0x3806
movl 0x10(%rsp), %eax
movq %rax, 0x220(%rbx)
movl 0x274(%rbx), %ebp
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0x10d66
cmpl $0x7d5, %ebp            # imm = 0x7D5
jl 0x387e
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x10d66
movl (%r14), %eax
movq %rax, 0x228(%rbx)
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
callq 0x10d66
jmp 0x3889
movl 0x10(%rsp), %eax
movq %rax, 0x228(%rbx)
movq 0x2b18(%rbx), %rdi
movq %rbx, %rsi
callq 0x24af
movq 0x2b18(%rbx), %rdi
leaq 0x20(%rbx), %rsi
callq 0x24af
movq 0x2b18(%rbx), %rdi
leaq 0x60(%rbx), %r14
movq %r14, %rsi
callq 0x24af
leaq 0x80(%rbx), %rdi
movq %r14, %rsi
callq 0x20a0
cmpl $0x0, 0x12f0(%rbx)
je 0x39c0
movq 0x2b18(%rbx), %rdi
leaq 0x12f4(%rbx), %r15
movq %r15, %rsi
callq 0x10fca
movslq 0x12f4(%rbx), %r12
leaq (,%r12,8), %r13
testq %r12, %r12
movq %r13, %rdi
pushq $-0x1
popq %rax
cmovsq %rax, %rdi
callq 0x2030
movq %rax, 0x1300(%rbx)
xorl %r14d, %r14d
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x20b0
pushq $0x20
popq %r13
leaq 0xc(%rsp), %rbp
movslq %r12d, %rax
cmpq %rax, %r14
jge 0x39c0
movq 0x2b18(%rbx), %rdi
movq %rsp, %rsi
callq 0x10fca
movq %r13, %rdi
callq 0x2130
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
andq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x1300(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
movq 0x1300(%rbx), %rax
movq (%rax,%r14,8), %rdi
movslq (%rsp), %rsi
callq 0x2200
movl (%rsp), %eax
testl %eax, %eax
jle 0x39b5
movq 0x2b18(%rbx), %rdi
movq %rbp, %rsi
callq 0x11060
movsbl 0xc(%rsp), %esi
movq 0x1300(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x20f0
movl (%rsp), %eax
decl %eax
movl %eax, (%rsp)
jmp 0x3983
incq %r14
movl (%r15), %r12d
jmp 0x392e
cmpl $0x0, 0x12ec(%rbx)
je 0x3ab2
movq 0x2b18(%rbx), %rdi
leaq 0x1310(%rbx), %r15
movq %r15, %rsi
callq 0x10fca
movslq 0x1310(%rbx), %r14
leaq (,%r14,8), %r12
testq %r14, %r14
pushq $-0x1
popq %rdi
cmovnsq %r12, %rdi
callq 0x2030
movq %rax, 0x1318(%rbx)
xorl %ebp, %ebp
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x20b0
pushq $0x20
popq %r12
leaq 0xc(%rsp), %r13
movslq %r14d, %rax
cmpq %rax, %rbp
jge 0x3ab2
movq 0x2b18(%rbx), %rdi
movq %rsp, %rsi
callq 0x10fca
movq %r12, %rdi
callq 0x2130
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
andq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x1318(%rbx), %rcx
movq %rax, (%rcx,%rbp,8)
movq 0x1318(%rbx), %rax
movq (%rax,%rbp,8), %rdi
movslq (%rsp), %rsi
callq 0x2200
movl (%rsp), %eax
testl %eax, %eax
jle 0x3aa7
movq 0x2b18(%rbx), %rdi
movq %r13, %rsi
callq 0x11060
movsbl 0xc(%rsp), %esi
movq 0x1318(%rbx), %rax
movq (%rax,%rbp,8), %rdi
callq 0x20f0
movl (%rsp), %eax
decl %eax
movl %eax, (%rsp)
jmp 0x3a75
incq %rbp
movl (%r15), %r14d
jmp 0x3a20
cmpl $0x0, 0x29c(%rbx)
je 0x3b37
movq 0x2b18(%rbx), %rdi
movl 0x298(%rbx), %eax
cmpl 0x20(%rdi), %eax
jne 0x3b37
movl 0x24c(%rbx), %eax
xorl %ebp, %ebp
cmpl $0x7d8, %eax            # imm = 0x7D8
jl 0x3af1
leaq 0x12b0(%rbx), %rsi
callq 0x10d66
movl 0x24c(%rbx), %eax
pushq $0x4
popq %rbp
cmpl $0x7d2, %eax            # imm = 0x7D2
jg 0x3b12
movq 0x2b18(%rbx), %rdi
leaq 0xc(%rsp), %rsi
callq 0x10d66
addl $0x4, %ebp
movl 0x24c(%rbx), %eax
cmpl $0x7d7, %eax            # imm = 0x7D7
jle 0x3b5c
movq 0x2b18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x10d78
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addl $0x8, %ebp
jmp 0x3b60
movl $0x6, 0x12e0(%rbx)
movb $0x0, 0x2b28(%rbx)
jmp 0x3caa
movl $0x8, 0x12e0(%rbx)
jmp 0x3cdb
movl 0xc(%rsp), %eax
cmpl 0x29c(%rbx), %eax
jne 0x3cd1
movq 0x2b18(%rbx), %rdi
leaq 0x280(%rbx), %r14
movq %r14, %rsi
callq 0x10d66
movq 0x2b18(%rbx), %rdi
leaq 0x288(%rbx), %rsi
callq 0x10d66
movl 0x288(%rbx), %eax
cmpl $0x12, %eax
ja 0x3d02
addl $0x8, %ebp
movl $0x7036a, %ecx          # imm = 0x7036A
btl %eax, %ecx
jae 0x3ce8
cmpl $0x5, %eax
jne 0x3bca
movq %rbx, %rdi
callq 0x42f6
addl %eax, %ebp
movl 0x288(%rbx), %eax
cmpl $0x10, %eax
je 0x3bd4
cmpl $0x8, %eax
jne 0x3be6
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4b5e
addl %eax, %ebp
movl 0x288(%rbx), %eax
cmpl $0x6, %eax
je 0x3bf0
cmpl $0x1, %eax
jne 0x3c00
movq %rbx, %rdi
callq 0x5742
addl %eax, %ebp
movl 0x288(%rbx), %eax
cmpl $0x3, %eax
jne 0x3c15
movq %rbx, %rdi
callq 0x5da2
addl %eax, %ebp
movl 0x288(%rbx), %eax
cmpl $0x9, %eax
jne 0x3c2a
movq %rbx, %rdi
callq 0x5efa
addl %eax, %ebp
movl 0x288(%rbx), %eax
cmpl $0x11, %eax
jne 0x3c3f
movq %rbx, %rdi
callq 0x605a
addl %eax, %ebp
movl 0x288(%rbx), %eax
cmpl $0x12, %eax
jne 0x3c4e
movq %rbx, %rdi
callq 0x6148
addl %eax, %ebp
movl 0x29c(%rbx), %eax
cmpl %ebp, %eax
jne 0x3c64
movl 0x290(%rbx), %ecx
cmpl 0x14(%rsp), %ecx
je 0x3c82
movl 0x288(%rbx), %ecx
movl %ecx, %esi
xorl $0x2, %esi
movl 0x12a4(%rbx), %edx
movl %edx, %edi
xorl $0x8, %edi
orl %esi, %edi
jne 0x3cb2
movl 0x14(%rsp), %ecx
cmpl $-0x1, %ecx
je 0x3c9c
movl 0x290(%rbx), %eax
cmpl $0xa, %eax
ja 0x3cd1
movl $0x464, %ecx            # imm = 0x464
btl %eax, %ecx
jae 0x3cd1
andl $0x0, 0x12e0(%rbx)
movb $0x1, 0x2b28(%rbx)
movb $0x1, %bpl
jmp 0x3502
cmpl $0x7, %edx
jne 0x3cd1
cmpl $0x6, %ecx
je 0x3cc1
cmpl $0x1, %ecx
jne 0x3cd1
cmpl $0x186a1, %eax          # imm = 0x186A1
jb 0x3cd1
cmpl $0x132677b, (%r14)      # imm = 0x132677B
je 0x3c7e
movl $0x6, 0x12e0(%rbx)
movq %rbx, %rdi
callq 0x31a6
jmp 0x3500
cmpl $0x2, %eax
jne 0x3d02
movq %rbx, %rdi
callq 0x3d0e
addl %eax, %ebp
movl 0x288(%rbx), %eax
jmp 0x3bb5
movl $0x7, 0x12e0(%rbx)
jmp 0x3cdb