// File: /workspace/github_cpp_makefile_star2_O3/NichtJens[P]lmf2txt/LMF_IO.cpp
// Function: LMF_IO::ReadfADC8_header_LMFversion10()
__int32	LMF_IO::ReadfADC8_header_LMFversion10()
{
	__int32 byte_counter = 0;
	*input_lmf >> this->number_of_DAQ_source_strings;  byte_counter += sizeof(__int32);

	DAQ_source_strings = new std::string*[number_of_DAQ_source_strings];
	memset(DAQ_source_strings,0,sizeof(std::string*)*number_of_DAQ_source_strings);
	for (__int32 i=0;i<number_of_DAQ_source_strings;++i) {
		__int32 string_len;
		*input_lmf >> string_len;	byte_counter += sizeof(__int32);
		DAQ_source_strings[i] = new std::string();
		DAQ_source_strings[i]->reserve(string_len);
		while (string_len > 0) {
			__int8 c;
			*input_lmf >> c;	byte_counter += sizeof(__int8);
			*DAQ_source_strings[i] += c;
			--string_len;
		}
	}

	*input_lmf >> time_reference;	byte_counter += sizeof(__int32);
	*input_lmf >> tdcresolution;	byte_counter += sizeof(double);		// tdc resolution in ns
	*input_lmf >> TDCDataType;		byte_counter += sizeof(__int32);

	unsigned __int64 temp_uint64;
	*input_lmf >> temp_uint64;		byte_counter += sizeof(unsigned __int64);		// number of channels
	number_of_channels =__int32(temp_uint64);

	*input_lmf >> temp_uint64;		byte_counter += sizeof(unsigned __int64);		// number of hits
	max_number_of_hits =__int32(temp_uint64);

	if (int(number_of_channels) > num_channels)	{errorflag = 19;	return -100000;}
	if (int(max_number_of_hits) > num_ions)		{errorflag = 20;	return -100000;}

	*input_lmf >> data_format_in_userheader;	byte_counter += sizeof(__int32);	// data format (2=short integer)


	// bools
	__int32 counter = 0;
	*input_lmf >> fADC8.number_of_bools; byte_counter += sizeof(__int32);
	for (__int32 i=counter;i<fADC8.number_of_bools;++i) {
		bool bool_dummy;
		*input_lmf >> bool_dummy;	byte_counter += sizeof(bool);
	}

	// unsigned 32bit
	counter = 0;
	*input_lmf >> fADC8.number_of_uint32s;		byte_counter += sizeof(__int32);
	
	*input_lmf >> fADC8.i32NumberOfDAQLoops;	byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.i32NumberOfADCmodules;	byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iEnableGroupMode;		byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iTriggerChannel;		byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iPreSamplings_in_4800ps_units;	byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iPostSamplings_in_9600ps_units;	byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iEnableTDCinputs;		byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iChannelMode[0][0];		byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iChannelMode[0][1];		byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iChannelMode[1][0];		byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iChannelMode[1][1];		byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iChannelMode[2][0];		byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iChannelMode[2][1];		byte_counter += sizeof(__int32); counter++;
	
	for (__int32 i=0;i<3;i++) {
		*input_lmf >> fADC8.firmware_version[i];	; byte_counter += sizeof(__int32); counter++; // adc module firmware
		*input_lmf >> fADC8.serial_number[i];		; byte_counter += sizeof(__int32); counter++; // adc module serial number
	}
	
	*input_lmf >> fADC8.driver_version; byte_counter += sizeof(__int32); counter++; // adc driver version number
	
	for (__int32 i=counter;i<fADC8.number_of_uint32s;++i) {
		unsigned __int32 uint_dummy;
		*input_lmf >> uint_dummy;				byte_counter += sizeof(unsigned __int32);
	}

	// signed 32bit
	counter = 0;
	*input_lmf >> fADC8.number_of_int32s;		byte_counter += sizeof(__int32);

	for (__int32 imod = 0; imod < 3; imod++) {
		for (__int32 ich = 0; ich < 8; ich++) {
			*input_lmf >> fADC8.iThreshold_GT[imod][ich];	byte_counter += sizeof(__int32);  counter++;
		}
	}
	for (__int32 imod = 0; imod < 3; imod++) {
		for (__int32 ich = 0; ich < 8; ich++) {
			*input_lmf >> fADC8.iThreshold_LT[imod][ich];	byte_counter += sizeof(__int32);  counter++;
		}
	}
	*input_lmf >> fADC8.iSynchronMode[0][0];	byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iSynchronMode[0][1];	byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iSynchronMode[1][0];	byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iSynchronMode[1][1];	byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iSynchronMode[2][0];	byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.iSynchronMode[2][1];	byte_counter += sizeof(__int32); counter++;
	
	*input_lmf >> fADC8.GroupEndMarker;			byte_counter += sizeof(__int32); counter++;
	
	if (fADC8.GroupEndMarker != 12345678) return 0;
	
	*input_lmf >> fADC8.veto_gate_length;		byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.veto_delay_length;		byte_counter += sizeof(__int32); counter++;
	*input_lmf >> fADC8.veto_mask;				byte_counter += sizeof(__int32); counter++;

	for (__int32 imod = 0; imod < 3; imod++) {
		for (__int32 ich = 0; ich < 8; ich++) {
			*input_lmf >> fADC8.GND_level[imod][ich]; byte_counter += sizeof(__int32); counter++;
		}
	}

	fADC8.bReadCustomData = false;
	if (counter < fADC8.number_of_int32s) {
		for (__int32 i=counter;i<fADC8.number_of_int32s;++i) {
			__int32 int_dummy;
			*input_lmf >> int_dummy;			byte_counter += sizeof(__int32);
			fADC8.bReadCustomData = int_dummy ? true:false;
		}
	}

	// doubles
	counter = 0;
	*input_lmf >> fADC8.number_of_doubles;		byte_counter += sizeof(__int32);
	*input_lmf >> fADC8.dGroupRangeStart;		byte_counter += sizeof(double); counter++;
	*input_lmf >> fADC8.dGroupRangeEnd;			byte_counter += sizeof(double); counter++;
	*input_lmf >> fADC8.dSyncTimeOffset[0][0];	byte_counter += sizeof(double); counter++;
	*input_lmf >> fADC8.dSyncTimeOffset[0][1];	byte_counter += sizeof(double); counter++;
	*input_lmf >> fADC8.dSyncTimeOffset[1][0];	byte_counter += sizeof(double); counter++;
	*input_lmf >> fADC8.dSyncTimeOffset[1][1];	byte_counter += sizeof(double); counter++;
	*input_lmf >> fADC8.dSyncTimeOffset[2][0];	byte_counter += sizeof(double); counter++;
	*input_lmf >> fADC8.dSyncTimeOffset[2][1];	byte_counter += sizeof(double); counter++;
	for (__int32 i=counter;i<fADC8.number_of_doubles;++i) {
		double double_dummy;
		*input_lmf >> double_dummy; byte_counter += sizeof(double);
	}

	__int32 int_dummy;
	*input_lmf >> int_dummy;	byte_counter += sizeof(__int32);
	if (int_dummy != 123456789) return 0;
	
	return byte_counter;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x2b18(%rdi), %rdi
leaq 0x1328(%rbx), %r14
movl $0x4, %ebp
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
movslq 0x1328(%rbx), %r12
leaq (,%r12,8), %r15
testq %r12, %r12
movq $-0x1, %rdi
cmovnsq %r15, %rdi
callq 0x2030
movq %rax, 0x1330(%rbx)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20b0
testq %r12, %r12
jle 0x9117
xorl %r13d, %r13d
leaq 0x10(%rsp), %r15
leaq 0x8(%rsp), %r12
movq 0x2b18(%rbx), %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x133bc
addl $0x4, %ebp
movl $0x20, %edi
callq 0x2130
leaq 0x10(%rax), %rcx
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x1330(%rbx), %rcx
movq %rax, (%rcx,%r13,8)
movq 0x1330(%rbx), %rax
movq (%rax,%r13,8), %rdi
movslq 0x10(%rsp), %rsi
callq 0x2210
cmpl $0x0, 0x10(%rsp)
jle 0x9103
movq 0x2b18(%rbx), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x133bc
incl %ebp
movsbl 0x8(%rsp), %esi
movq 0x1330(%rbx), %rax
movq (%rax,%r13,8), %rdi
callq 0x20f0
movl 0x10(%rsp), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsp)
cmpl $0x1, %eax
jg 0x90c8
incq %r13
movslq (%r14), %rax
cmpq %rax, %r13
jl 0x906d
addl $0x28, %ebp
jmp 0x911c
movl $0x2c, %ebp
movq 0x2b18(%rbx), %rdi
leaq 0x240(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x12b8(%rbx), %rsi
movl $0x8, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x12ac(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
movl $0x8, %edx
callq 0x133bc
movl (%r14), %eax
movl %eax, 0x2b4(%rbx)
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x133bc
movl (%r14), %eax
movl %eax, 0x2bc(%rbx)
movl 0x2b4(%rbx), %ecx
cmpl 0x2b70(%rbx), %ecx
jle 0x91bd
movl $0x13, 0x12e0(%rbx)
jmp 0x91cf
cmpl %eax, 0x2b74(%rbx)
jge 0x91e3
movl $0x14, 0x12e0(%rbx)
movl $0xfffe7960, %eax       # imm = 0xFFFE7960
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2b18(%rbx), %rdi
leaq 0x290(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15a8(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
cmpl $0x0, 0x15a8(%rbx)
jle 0x9247
xorl %r15d, %r15d
leaq 0x8(%rsp), %r14
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x133bc
incl %r15d
cmpl 0x15a8(%rbx), %r15d
jl 0x9224
addl %r15d, %ebp
leaq 0x15a0(%rbx), %r14
movq 0x2b18(%rbx), %rdi
leaq 0x15b0(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15a4(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15bc(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15c0(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15c4(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15c8(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15cc(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15d0(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15d4(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15d8(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15dc(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15e0(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15e4(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15e8(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
leaq 0x1878(%rbx), %r15
movl $0x3, %r12d
movq 0x2b18(%rbx), %rdi
leaq -0x20(%r15), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x133bc
addq $0x4, %r15
decq %r12
jne 0x93ab
addl $0x50, %ebp
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
cmpl $0x15, 0x15b0(%rbx)
jl 0x942b
movl $0x14, %r15d
leaq 0x8(%rsp), %r14
addl $0x4, %ebp
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
incl %r15d
cmpl 0x15b0(%rbx), %r15d
jl 0x9408
movq 0x2b18(%rbx), %rdi
leaq 0x15ac(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
leaq 0x1614(%rbx), %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x2b18(%rbx), %rdi
leaq (%r14,%r12), %rsi
movl $0x4, %edx
callq 0x133bc
addq $0x4, %r12
cmpq $0x20, %r12
jne 0x9450
incq %r15
addq $0x20, %r14
cmpq $0x3, %r15
jne 0x944d
leaq 0x1714(%rbx), %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x2b18(%rbx), %rdi
leaq (%r14,%r12), %rsi
movl $0x4, %edx
callq 0x133bc
addq $0x4, %r12
cmpq $0x20, %r12
jne 0x9489
incq %r15
addq $0x20, %r14
cmpq $0x3, %r15
jne 0x9486
movq 0x2b18(%rbx), %rdi
leaq 0x1814(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x1818(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x181c(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x1820(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x1824(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x1828(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x15b8(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
xorl %eax, %eax
cmpl $0xbc614e, 0x15b8(%rbx) # imm = 0xBC614E
jne 0x91d4
movq 0x2b18(%rbx), %rdi
leaq 0x1898(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x189c(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x18a0(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
leaq 0x18a4(%rbx), %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x2b18(%rbx), %rdi
leaq (%r14,%r12), %rsi
movl $0x4, %edx
callq 0x133bc
addq $0x4, %r12
cmpq $0x20, %r12
jne 0x95c4
incq %r15
addq $0x28, %r14
cmpq $0x3, %r15
jne 0x95c1
addl $0x150, %ebp            # imm = 0x150
movb $0x0, 0x1854(%rbx)
cmpl $0x53, 0x15ac(%rbx)
jl 0x9640
movl $0x52, %r15d
leaq 0x8(%rsp), %r14
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x133bc
addl $0x4, %ebp
cmpl $0x0, 0x8(%rsp)
setne 0x1854(%rbx)
incl %r15d
cmpl 0x15ac(%rbx), %r15d
jl 0x9611
movq 0x2b18(%rbx), %rdi
leaq 0x15b4(%rbx), %rsi
movl $0x4, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x19e8(%rbx), %rsi
movl $0x8, %r15d
movl $0x8, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x19f0(%rbx), %rsi
movl $0x8, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x19f8(%rbx), %rsi
movl $0x8, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x1a00(%rbx), %rsi
movl $0x8, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x1a08(%rbx), %rsi
movl $0x8, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x1a10(%rbx), %rsi
movl $0x8, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x1a18(%rbx), %rsi
movl $0x8, %edx
callq 0x133bc
movq 0x2b18(%rbx), %rdi
leaq 0x1a20(%rbx), %rsi
movl $0x8, %edx
callq 0x133bc
addl $0x44, %ebp
cmpl $0x9, 0x15b4(%rbx)
jl 0x9752
leaq 0x8(%rsp), %r14
movq 0x2b18(%rbx), %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x133bc
addl $0x8, %ebp
incl %r15d
cmpl 0x15b4(%rbx), %r15d
jl 0x972f
movq 0x2b18(%rbx), %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
movl $0x4, %edx
callq 0x133bc
addl $0x4, %ebp
xorl %eax, %eax
cmpl $0x75bcd15, (%rbx)      # imm = 0x75BCD15
cmovel %ebp, %eax
jmp 0x91d4