// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, 0x2b4c(%rdi)
jne 0xf6a2
movq %r14, %rdi
callq 0xde8a
testb %al, %al
je 0xf8fb
movl 0x2b70(%r14), %eax
movslq 0x2b74(%r14), %rcx
movl 0x290(%r14), %edx
cmpl $0xa, %edx
je 0xf76c
cmpl $0x2, %edx
je 0xf7db
cmpl $0x5, %edx
je 0xf844
cmpl $-0x1, %edx
jne 0xf8fb
movl 0x288(%r14), %edx
cmpl $0x10, %edx
ja 0xf8fb
pushq $0x26
popq %rsi
btl %edx, %esi
jb 0xf8a8
movl $0x10100, %edi          # imm = 0x10100
btl %edx, %edi
jae 0xf8fb
xorl %edi, %edi
testl %ecx, %ecx
movl $0x0, %r8d
cmovgl %ecx, %r8d
testl %eax, %eax
movl $0x0, %r9d
cmovgl %eax, %r9d
leaq (,%rcx,4), %r10
leaq (,%rcx,8), %r11
movq %rbx, %r15
xorl %r12d, %r12d
cmpq %r9, %r12
je 0xf89e
movq 0x2b58(%r14), %r13
addq %rdi, %r13
xorl %ebp, %ebp
cmpq %rbp, %r8
je 0xf761
cvtsi2sdl (%r13,%rbp,4), %xmm0
movsd %xmm0, (%r15,%rbp,8)
incq %rbp
jmp 0xf74a
incq %r12
addq %r10, %rdi
addq %r11, %r15
jmp 0xf735
xorl %esi, %esi
testl %ecx, %ecx
movl $0x0, %edi
cmovgl %ecx, %edi
testl %eax, %eax
movl $0x0, %r8d
cmovgl %eax, %r8d
leaq (,%rcx,4), %r9
leaq (,%rcx,8), %r10
movq %rbx, %r11
xorl %r15d, %r15d
cmpq %r8, %r15
je 0xf7cd
movq 0x2b58(%r14), %r12
addq %rsi, %r12
xorl %r13d, %r13d
cmpq %r13, %rdi
je 0xf7c2
cvtsi2sdl (%r12,%r13,4), %xmm0
movsd %xmm0, (%r11,%r13,8)
incq %r13
jmp 0xf7ac
incq %r15
addq %r9, %rsi
addq %r10, %r11
jmp 0xf79a
cmpl $0x5, %edx
je 0xf844
cmpl $0x2, %edx
jne 0xf8fb
xorl %esi, %esi
testl %ecx, %ecx
movl $0x0, %edi
cmovgl %ecx, %edi
testl %eax, %eax
movl $0x0, %r8d
cmovgl %eax, %r8d
leaq (%rcx,%rcx), %r9
leaq (,%rcx,8), %r10
movq %rbx, %r11
xorl %r15d, %r15d
cmpq %r8, %r15
je 0xf83b
movq 0x2b60(%r14), %r12
addq %rsi, %r12
xorl %r13d, %r13d
cmpq %r13, %rdi
je 0xf830
movzwl (%r12,%r13,2), %ebp
cvtsi2sd %ebp, %xmm0
movsd %xmm0, (%r11,%r13,8)
incq %r13
jmp 0xf817
incq %r15
addq %r9, %rsi
addq %r10, %r11
jmp 0xf805
cmpl $0x5, %edx
jne 0xf8fb
xorl %edx, %edx
testl %ecx, %ecx
movl $0x0, %esi
cmovgl %ecx, %esi
testl %eax, %eax
cmovlel %edx, %eax
shlq $0x3, %rcx
movsd 0x2867(%rip), %xmm0     # 0x120c8
xorl %edi, %edi
cmpq %rax, %rdi
je 0xf8fb
movq 0x2b68(%r14), %r8
addq %rdx, %r8
xorl %r9d, %r9d
cmpq %r9, %rsi
je 0xf893
movsd (%r8,%r9,8), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rbx,%r9,8)
incq %r9
jmp 0xf879
incq %rdi
addq %rcx, %rdx
addq %rcx, %rbx
jmp 0xf863
cmpl $0x5, %edx
ja 0xf8fb
btl %edx, %esi
jae 0xf8fb
xorl %edx, %edx
testl %ecx, %ecx
movl $0x0, %esi
cmovgl %ecx, %esi
testl %eax, %eax
cmovlel %edx, %eax
leaq (%rcx,%rcx), %rdi
shlq $0x3, %rcx
xorl %r8d, %r8d
cmpq %rax, %r8
je 0xf8fb
movq 0x2b60(%r14), %r9
addq %rdx, %r9
xorl %r10d, %r10d
cmpq %r10, %rsi
je 0xf8f0
movzwl (%r9,%r10,2), %r11d
cvtsi2sd %r11d, %xmm0
movsd %xmm0, (%rbx,%r10,8)
incq %r10
jmp 0xf8d6
incq %r8
addq %rdi, %rdx
addq %rcx, %rbx
jmp 0xf8c4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq