// File: NichtJens[P]lmf2txt/LMF_IO.cpp
// Function: LMF_IO::GetTDCDataArray(double*)
void LMF_IO::GetTDCDataArray(double *tdc)
/////////////////////////////////////////////////////////////////
{
	__int32 i,j;

	if (must_read_first) {
		if (!ReadNextEvent()) return;
	}

	//__int32 max_channel = (number_of_channels+number_of_channels2 < num_channels) ? (number_of_channels+number_of_channels2) : num_channels;
	//__int32 max_hits = (max_number_of_hits < num_ions) ? max_number_of_hits : num_ions;
	__int32 max_channel = num_channels;
	__int32 max_hits = num_ions;

	if (data_format_in_userheader == LM_USERDEF) {
		if (DAQ_ID == DAQ_ID_TDC8HP || DAQ_ID == DAQ_ID_TDC8HPRAW) {
			for (i=0;i<max_channel;++i) {
				for (j=0;j<max_hits;++j) tdc[i*num_ions+j] = double(i32TDC[i*num_ions+j]);
			}
		}
		if (DAQ_ID == DAQ_ID_TDC8 || DAQ_ID == DAQ_ID_2TDC8 || DAQ_ID == DAQ_ID_HM1) {
			for (i=0;i<max_channel;++i) {
				for (j=0;j<max_hits;++j) tdc[i*num_ions+j] = double(us16TDC[i*num_ions+j]);
			}
		}
	}
	if (data_format_in_userheader == 10) {
		for (i=0;i<max_channel;++i) {
			for (j=0;j<max_hits;++j) tdc[i*num_ions+j] = double(i32TDC[i*num_ions+j]);
		}
	}
	if (data_format_in_userheader == 2) {
		for (i=0;i<max_channel;++i) {
			for (j=0;j<max_hits;++j) tdc[i*num_ions+j] = double(us16TDC[i*num_ions+j]);
		}
	}
	if (data_format_in_userheader == 5) {
		for (i=0;i<max_channel;++i) {
			for (j=0;j<max_hits;++j) tdc[i*num_ions+j] = dTDC[i*num_ions+j]+1e-7;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
testb $0x1, 0x2b4c(%rax)
je 0x19b05
movq -0x28(%rbp), %rdi
callq 0x17050
testb $0x1, %al
jne 0x19b03
jmp 0x19ddd
jmp 0x19b05
movq -0x28(%rbp), %rax
movl 0x2b70(%rax), %ecx
movl %ecx, -0x1c(%rbp)
movl 0x2b74(%rax), %ecx
movl %ecx, -0x20(%rbp)
cmpl $-0x1, 0x290(%rax)
jne 0x19c54
movq -0x28(%rbp), %rax
cmpl $0x8, 0x288(%rax)
je 0x19b42
movq -0x28(%rbp), %rax
cmpl $0x10, 0x288(%rax)
jne 0x19bb3
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x19bb1
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x19ba4
movq -0x28(%rbp), %rdx
movq 0x2b58(%rdx), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rdx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rdx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x19b58
jmp 0x19ba6
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x19b49
jmp 0x19bb3
movq -0x28(%rbp), %rax
cmpl $0x2, 0x288(%rax)
je 0x19bda
movq -0x28(%rbp), %rax
cmpl $0x5, 0x288(%rax)
je 0x19bda
movq -0x28(%rbp), %rax
cmpl $0x1, 0x288(%rax)
jne 0x19c52
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x19c50
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x19c43
movq -0x28(%rbp), %rdx
movq 0x2b60(%rdx), %rax
movl -0x14(%rbp), %ecx
movl 0x2b74(%rdx), %esi
imull %esi, %ecx
movl -0x18(%rbp), %esi
addl %esi, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
cvtsi2sd %eax, %xmm0
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rdx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x19bf0
jmp 0x19c45
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x19be1
jmp 0x19c52
jmp 0x19c54
movq -0x28(%rbp), %rax
cmpl $0xa, 0x290(%rax)
jne 0x19cd2
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x19cd0
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x19cc3
movq -0x28(%rbp), %rdx
movq 0x2b58(%rdx), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rdx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rdx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x19c77
jmp 0x19cc5
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x19c68
jmp 0x19cd2
movq -0x28(%rbp), %rax
cmpl $0x2, 0x290(%rax)
jne 0x19d57
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x19d55
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x19d48
movq -0x28(%rbp), %rdx
movq 0x2b60(%rdx), %rax
movl -0x14(%rbp), %ecx
movl 0x2b74(%rdx), %esi
imull %esi, %ecx
movl -0x18(%rbp), %esi
addl %esi, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
cvtsi2sd %eax, %xmm0
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rdx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x19cf5
jmp 0x19d4a
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x19ce6
jmp 0x19d57
movq -0x28(%rbp), %rax
cmpl $0x5, 0x290(%rax)
jne 0x19ddd
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x19ddb
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x19dce
movq -0x28(%rbp), %rdx
movq 0x2b68(%rdx), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rdx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movsd 0x52bb(%rip), %xmm0     # 0x1f060
addsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rdx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x19d7a
jmp 0x19dd0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x19d6b
jmp 0x19ddd
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)