// File: /workspace/github_cpp_makefile_star2_O2/NichtJens[P]lmf2txt/LMF_IO.cpp
// Function: LMF_IO::GetTDCDataArray(unsigned short*)
void LMF_IO::GetTDCDataArray(unsigned __int16 *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] = (unsigned __int16)(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] = (unsigned __int16)(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] = (unsigned __int16)(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] = 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] = (unsigned __int16)(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 0xf426
movq %r14, %rdi
callq 0xde8a
testb %al, %al
je 0xf669
movl 0x2b70(%r14), %eax
movslq 0x2b74(%r14), %rcx
movl 0x290(%r14), %edx
cmpl $0xa, %edx
je 0xf4ea
cmpl $0x2, %edx
je 0xf553
cmpl $0x5, %edx
je 0xf5af
cmpl $-0x1, %edx
jne 0xf669
movl 0x288(%r14), %edx
cmpl $0x10, %edx
ja 0xf669
pushq $0x26
popq %rsi
btl %edx, %esi
jb 0xf622
movl $0x10100, %edi          # imm = 0x10100
btl %edx, %edi
jae 0xf669
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,%rcx), %r11
movq %rbx, %r15
xorl %r12d, %r12d
cmpq %r9, %r12
je 0xf615
movq 0x2b58(%r14), %r13
addq %rdi, %r13
xorl %ebp, %ebp
cmpq %rbp, %r8
je 0xf4df
movzwl (%r13,%rbp,4), %esi
movw %si, (%r15,%rbp,2)
incq %rbp
jmp 0xf4ca
incq %r12
addq %r10, %rdi
addq %r11, %r15
jmp 0xf4b5
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,%rcx), %r10
movq %rbx, %r11
xorl %r15d, %r15d
cmpq %r8, %r15
je 0xf545
movq 0x2b58(%r14), %r12
addq %rsi, %r12
xorl %r13d, %r13d
cmpq %r13, %rdi
je 0xf53a
movzwl (%r12,%r13,4), %ebp
movw %bp, (%r11,%r13,2)
incq %r13
jmp 0xf526
incq %r15
addq %r9, %rsi
addq %r10, %r11
jmp 0xf514
cmpl $0x5, %edx
je 0xf5af
cmpl $0x2, %edx
jne 0xf669
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
movq %rbx, %r10
xorl %r11d, %r11d
cmpq %r8, %r11
je 0xf5a6
movq 0x2b60(%r14), %r15
addq %rsi, %r15
xorl %r12d, %r12d
cmpq %r12, %rdi
je 0xf59b
movzwl (%r15,%r12,2), %ebp
movw %bp, (%r10,%r12,2)
incq %r12
jmp 0xf587
incq %r11
addq %r9, %rsi
addq %r9, %r10
jmp 0xf575
cmpl $0x5, %edx
jne 0xf669
xorl %edx, %edx
testl %ecx, %ecx
movl $0x0, %esi
cmovgl %ecx, %esi
testl %eax, %eax
cmovlel %edx, %eax
leaq (,%rcx,8), %rdi
addq %rcx, %rcx
movsd 0x2af5(%rip), %xmm0     # 0x120c8
xorl %r8d, %r8d
cmpq %rax, %r8
je 0xf669
movq 0x2b68(%r14), %r9
addq %rdx, %r9
xorl %r10d, %r10d
cmpq %r10, %rsi
je 0xf60a
movsd (%r9,%r10,8), %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %r11d
movw %r11w, (%rbx,%r10,2)
incq %r10
jmp 0xf5ec
incq %r8
addq %rdi, %rdx
addq %rcx, %rbx
jmp 0xf5d6
cmpl $0x5, %edx
pushq $0x26
popq %rsi
ja 0xf669
btl %edx, %esi
jae 0xf669
xorl %edx, %edx
testl %ecx, %ecx
movl $0x0, %esi
cmovgl %ecx, %esi
testl %eax, %eax
cmovlel %edx, %eax
addq %rcx, %rcx
xorl %edi, %edi
cmpq %rax, %rdi
je 0xf669
movq 0x2b60(%r14), %r8
addq %rdx, %r8
xorl %r9d, %r9d
cmpq %r9, %rsi
je 0xf65e
movzwl (%r8,%r9,2), %r10d
movw %r10w, (%rbx,%r9,2)
incq %r9
jmp 0xf64a
incq %rdi
addq %rcx, %rdx
addq %rcx, %rbx
jmp 0xf638
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq