// File: /workspace/github_cpp_makefile_star2_O3/NichtJens[P]lmf2txt/LMF_IO.cpp
// Function: LMF_IO::GetTDCDataArray(int*)
void LMF_IO::GetTDCDataArray(__int32 *tdc)
/////////////////////////////////////////////////////////////////
{
	__int32 i,j;
	__int32 ii = 0;

	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] = 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] = 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] = 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] =__int32(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) {
				if (dTDC[i*num_ions+j] >= 0.) ii =__int32(dTDC[i*num_ions+j]+1.e-19);
				if (dTDC[i*num_ions+j] <  0.) ii =__int32(dTDC[i*num_ions+j]-1.e-19);
				tdc[i*num_ions+j] = ii;
			}
		}
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, 0x2b4c(%rdi)
jne 0x11833
movq %r14, %rdi
callq 0x100fa
testb %al, %al
je 0x11a1e
movl 0x2b70(%r14), %eax
movl 0x2b74(%r14), %ecx
movl 0x290(%r14), %edx
cmpl $-0x1, %edx
jne 0x118f6
movl 0x288(%r14), %edx
cmpl $0x10, %edx
je 0x11862
cmpl $0x8, %edx
jne 0x118a4
testl %eax, %eax
jle 0x118a4
movq 0x2b58(%r14), %rdx
xorl %esi, %esi
testl %ecx, %ecx
jle 0x11897
movslq %esi, %rdi
xorl %r8d, %r8d
movslq 0x2b74(%r14), %r9
imulq %rdi, %r9
addq %r8, %r9
movl (%rdx,%r9,4), %r10d
movl %r10d, (%rbx,%r9,4)
incq %r8
cmpl %r8d, %ecx
jne 0x11879
incl %esi
cmpl %eax, %esi
jne 0x1186f
movl 0x288(%r14), %edx
cmpl $0x5, %edx
ja 0x118ef
movl $0x26, %esi
btl %edx, %esi
jae 0x118ef
testl %eax, %eax
jle 0x118ef
movq 0x2b60(%r14), %rdx
xorl %esi, %esi
testl %ecx, %ecx
jle 0x118e9
movslq %esi, %rdi
xorl %r8d, %r8d
movslq 0x2b74(%r14), %r9
imulq %rdi, %r9
addq %r8, %r9
movzwl (%rdx,%r9,2), %r10d
movl %r10d, (%rbx,%r9,4)
incq %r8
cmpl %r8d, %ecx
jne 0x118ca
incl %esi
cmpl %eax, %esi
jne 0x118c0
movl 0x290(%r14), %edx
cmpl $0xa, %edx
sete %sil
testl %eax, %eax
setg %dil
andb %sil, %dil
cmpb $0x1, %dil
jne 0x1194a
movq 0x2b58(%r14), %rdx
xorl %esi, %esi
testl %ecx, %ecx
jle 0x1193d
movslq %esi, %rdi
xorl %r8d, %r8d
movslq 0x2b74(%r14), %r9
imulq %rdi, %r9
addq %r8, %r9
movl (%rdx,%r9,4), %r10d
movl %r10d, (%rbx,%r9,4)
incq %r8
cmpl %r8d, %ecx
jne 0x1191f
incl %esi
cmpl %eax, %esi
jne 0x11915
movl 0x290(%r14), %edx
cmpl $0x2, %edx
jne 0x11996
testl %eax, %eax
jle 0x11a1e
movq 0x2b60(%r14), %rdx
xorl %esi, %esi
testl %ecx, %ecx
jle 0x11989
movslq %esi, %rdi
xorl %r8d, %r8d
movslq 0x2b74(%r14), %r9
imulq %rdi, %r9
addq %r8, %r9
movzwl (%rdx,%r9,2), %r10d
movl %r10d, (%rbx,%r9,4)
incq %r8
cmpl %r8d, %ecx
jne 0x1196a
incl %esi
cmpl %eax, %esi
jne 0x11960
movl 0x290(%r14), %edx
testl %eax, %eax
setg %sil
cmpl $0x5, %edx
sete %dl
andb %sil, %dl
cmpb $0x1, %dl
jne 0x11a1e
movq 0x2b68(%r14), %rdx
xorl %esi, %esi
xorpd %xmm0, %xmm0
movsd 0x2729(%rip), %xmm1     # 0x140e8
movsd 0x2729(%rip), %xmm2     # 0x140f0
xorl %edi, %edi
testl %ecx, %ecx
jle 0x11a18
movslq %esi, %r8
xorl %r9d, %r9d
movslq 0x2b74(%r14), %r10
imulq %r8, %r10
addq %r9, %r10
movsd (%rdx,%r10,8), %xmm3
ucomisd %xmm0, %xmm3
movapd %xmm3, %xmm4
addsd %xmm1, %xmm4
cvttsd2si %xmm4, %r11d
cmovbl %edi, %r11d
ucomisd %xmm3, %xmm0
addsd %xmm2, %xmm3
cvttsd2si %xmm3, %edi
cmovbel %r11d, %edi
movl %edi, (%rbx,%r10,4)
incq %r9
cmpl %r9d, %ecx
jne 0x119d3
incl %esi
cmpl %eax, %esi
jne 0x119c9
addq $0x8, %rsp
popq %rbx
popq %r14
retq