// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, 0x2b4c(%rdi)
jne 0xf1e3
movq %r14, %rdi
callq 0xde8a
testb %al, %al
je 0xf3f6
movl 0x2b70(%r14), %eax
movl 0x2b74(%r14), %ecx
movl 0x290(%r14), %edx
cmpl $-0x1, %edx
jne 0xf2c4
movl 0x288(%r14), %edx
cmpl $0x10, %edx
je 0xf212
cmpl $0x8, %edx
jne 0xf264
xorl %edx, %edx
testl %ecx, %ecx
movl $0x0, %esi
cmovgl %ecx, %esi
testl %eax, %eax
movl $0x0, %edi
cmovgl %eax, %edi
cmpl %edi, %edx
je 0xf25d
movq 0x2b58(%r14), %r8
movslq %edx, %r9
xorl %r10d, %r10d
cmpl %r10d, %esi
je 0xf259
movslq 0x2b74(%r14), %r11
imulq %r9, %r11
addq %r10, %r11
movl (%r8,%r11,4), %ebp
movl %ebp, (%rbx,%r11,4)
incq %r10
jmp 0xf239
incl %edx
jmp 0xf228
movl 0x288(%r14), %edx
cmpl $0x5, %edx
ja 0xf2bd
pushq $0x26
popq %rsi
btl %edx, %esi
jae 0xf2bd
xorl %edx, %edx
testl %ecx, %ecx
movl $0x0, %esi
cmovgl %ecx, %esi
testl %eax, %eax
movl $0x0, %edi
cmovgl %eax, %edi
cmpl %edi, %edx
je 0xf2bd
movq 0x2b60(%r14), %r8
movslq %edx, %r9
xorl %r10d, %r10d
cmpl %r10d, %esi
je 0xf2b9
movslq 0x2b74(%r14), %r11
imulq %r9, %r11
addq %r10, %r11
movzwl (%r8,%r11,2), %ebp
movl %ebp, (%rbx,%r11,4)
incq %r10
jmp 0xf298
incl %edx
jmp 0xf287
movl 0x290(%r14), %edx
cmpl $0xa, %edx
jne 0xf31b
xorl %edx, %edx
testl %ecx, %ecx
movl $0x0, %esi
cmovgl %ecx, %esi
testl %eax, %eax
movl $0x0, %edi
cmovgl %eax, %edi
cmpl %edi, %edx
je 0xf314
movq 0x2b58(%r14), %r8
movslq %edx, %r9
xorl %r10d, %r10d
cmpl %r10d, %esi
je 0xf310
movslq 0x2b74(%r14), %r11
imulq %r9, %r11
addq %r10, %r11
movl (%r8,%r11,4), %ebp
movl %ebp, (%rbx,%r11,4)
incq %r10
jmp 0xf2f0
incl %edx
jmp 0xf2df
movl 0x290(%r14), %edx
cmpl $0x2, %edx
jne 0xf373
xorl %edx, %edx
testl %ecx, %ecx
movl $0x0, %esi
cmovgl %ecx, %esi
testl %eax, %eax
movl $0x0, %edi
cmovgl %eax, %edi
cmpl %edi, %edx
je 0xf36c
movq 0x2b60(%r14), %r8
movslq %edx, %r9
xorl %r10d, %r10d
cmpl %r10d, %esi
je 0xf368
movslq 0x2b74(%r14), %r11
imulq %r9, %r11
addq %r10, %r11
movzwl (%r8,%r11,2), %ebp
movl %ebp, (%rbx,%r11,4)
incq %r10
jmp 0xf347
incl %edx
jmp 0xf336
movl 0x290(%r14), %edx
cmpl $0x5, %edx
jne 0xf3f6
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
testl %eax, %eax
cmovlel %edx, %eax
xorpd %xmm0, %xmm0
movsd 0x2d28(%rip), %xmm1     # 0x120b8
movsd 0x2d28(%rip), %xmm2     # 0x120c0
xorl %esi, %esi
cmpl %eax, %esi
je 0xf3f6
movq 0x2b68(%r14), %rdi
movslq %esi, %r8
xorl %r9d, %r9d
cmpl %r9d, %ecx
je 0xf3f2
movslq 0x2b74(%r14), %r10
imulq %r8, %r10
addq %r9, %r10
movsd (%rdi,%r10,8), %xmm3
ucomisd %xmm0, %xmm3
movapd %xmm3, %xmm4
addsd %xmm1, %xmm4
cvttsd2si %xmm4, %r11d
cmovbl %edx, %r11d
ucomisd %xmm3, %xmm0
addsd %xmm2, %xmm3
cvttsd2si %xmm3, %edx
cmovbel %r11d, %edx
movl %edx, (%rbx,%r10,4)
incq %r9
jmp 0xf3ab
incl %esi
jmp 0xf39a
popq %rbx
popq %r14
popq %rbp
retq
nop