// File: NichtJens[P]lmf2txt/LMF_IO.cpp
// Function: LMF_IO::ReadCAMACHeader()
__int32	LMF_IO::ReadCAMACHeader()
/////////////////////////////////////////////////////////////////
{
	__int32 byte_counter;
	byte_counter = 0;

	*input_lmf >> frequency;	byte_counter += sizeof(double);		// frequency is always 4th value
	*input_lmf >> IOaddress;	byte_counter += sizeof(__int32);		// IO address (parameter 1) always 5th value
	*input_lmf >> timestamp_format;	byte_counter += sizeof(__int32);	// TimeInfo (parameter 2) always 6th value  (0,1,2)*32Bit

	*input_lmf >> DAQ_info_Length;	byte_counter += sizeof(__int32);		// Length of DAQInfo always 7th value
	__int8 * __int8_temp = new __int8[DAQ_info_Length+1];
	input_lmf->read(__int8_temp,DAQ_info_Length);	// DAQInfo always 8th value
	__int8_temp[DAQ_info_Length] = 0;
	DAQ_info = __int8_temp;
	delete[] __int8_temp; __int8_temp = 0;
	byte_counter += DAQ_info_Length;

	*input_lmf >> Camac_CIF_Length;	byte_counter += sizeof(__int32);
	__int8_temp = new __int8[Camac_CIF_Length+1];
	input_lmf->read(__int8_temp,Camac_CIF_Length);
	__int8_temp[Camac_CIF_Length] = 0;
	Camac_CIF = __int8_temp;
	delete[] __int8_temp; __int8_temp = 0;
	byte_counter += Camac_CIF_Length;

	*input_lmf >> system_timeout; byte_counter += sizeof(__int32);		// system time-out
	*input_lmf >> time_reference; byte_counter += sizeof(__int32);
	*input_lmf >> data_format_in_userheader;	byte_counter += sizeof(__int32);		// data format (2=short integer)

	return byte_counter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0x28(%rbp)
movl $0x0, -0xc(%rbp)
movq 0x2b18(%rsi), %rdi
addq $0x12c8, %rsi           # imm = 0x12C8
callq 0x1d1f0
movq -0x28(%rbp), %rsi
movslq -0xc(%rbp), %rax
addq $0x8, %rax
movl %eax, -0xc(%rbp)
movq 0x2b18(%rsi), %rdi
addq $0x2a4, %rsi            # imm = 0x2A4
callq 0x1cf60
movq -0x28(%rbp), %rsi
movslq -0xc(%rbp), %rax
addq $0x4, %rax
movl %eax, -0xc(%rbp)
movq 0x2b18(%rsi), %rdi
addq $0x2a8, %rsi            # imm = 0x2A8
callq 0x1cb80
movq -0x28(%rbp), %rsi
movslq -0xc(%rbp), %rax
addq $0x4, %rax
movl %eax, -0xc(%rbp)
movq 0x2b18(%rsi), %rdi
addq $0x129c, %rsi           # imm = 0x129C
callq 0x1cf60
movq -0x28(%rbp), %rax
movslq -0xc(%rbp), %rcx
addq $0x4, %rcx
movl %ecx, -0xc(%rbp)
movl 0x129c(%rax), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x2030
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x18(%rbp)
movq 0x2b18(%rax), %rdi
movq -0x18(%rbp), %rsi
movl 0x129c(%rax), %edx
callq 0x1cbe0
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq 0x129c(%rdi), %rcx
movb $0x0, (%rax,%rcx)
movq -0x18(%rbp), %rsi
addq $0xa0, %rdi
callq 0x2250
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x88cf
movq -0x20(%rbp), %rdi
callq 0x2240
movq -0x28(%rbp), %rsi
movq $0x0, -0x18(%rbp)
movl 0x129c(%rsi), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movq 0x2b18(%rsi), %rdi
addq $0x12a0, %rsi           # imm = 0x12A0
callq 0x1cf60
movq -0x28(%rbp), %rax
movslq -0xc(%rbp), %rcx
addq $0x4, %rcx
movl %ecx, -0xc(%rbp)
movl 0x12a0(%rax), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x2030
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x18(%rbp)
movq 0x2b18(%rax), %rdi
movq -0x18(%rbp), %rsi
movl 0x12a0(%rax), %edx
callq 0x1cbe0
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq 0x12a0(%rdi), %rcx
movb $0x0, (%rax,%rcx)
movq -0x18(%rbp), %rsi
addq $0xc0, %rdi
callq 0x2250
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x8975
movq -0x30(%rbp), %rdi
callq 0x2240
movq -0x28(%rbp), %rsi
movq $0x0, -0x18(%rbp)
movl 0x12a0(%rsi), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movq 0x2b18(%rsi), %rdi
addq $0x128c, %rsi           # imm = 0x128C
callq 0x1cf60
movq -0x28(%rbp), %rsi
movslq -0xc(%rbp), %rax
addq $0x4, %rax
movl %eax, -0xc(%rbp)
movq 0x2b18(%rsi), %rdi
addq $0x240, %rsi            # imm = 0x240
callq 0x1cf60
movq -0x28(%rbp), %rsi
movslq -0xc(%rbp), %rax
addq $0x4, %rax
movl %eax, -0xc(%rbp)
movq 0x2b18(%rsi), %rdi
addq $0x290, %rsi            # imm = 0x290
callq 0x1cf60
movslq -0xc(%rbp), %rax
addq $0x4, %rax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)