// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, 0x2b4c(%rdi)
jne 0x11e1c
movq %r14, %rdi
callq 0x1029e
testb %al, %al
je 0x12039
movl 0x2b70(%r14), %ecx
movl 0x2b74(%r14), %eax
movl 0x290(%r14), %edx
cmpl $0x4, %edx
jg 0x11f18
cmpl $-0x1, %edx
jne 0x11f7c
movl 0x288(%r14), %esi
cmpl $0x10, %esi
ja 0x11f13
movl $0x26, %edi
btl %esi, %edi
jb 0x11ec7
movl $0x10100, %edi          # imm = 0x10100
btl %esi, %edi
jae 0x11f13
testl %ecx, %ecx
jle 0x11eb8
movq 0x2b58(%r14), %rdi
leaq (,%rax,8), %r8
leaq (,%rax,4), %r9
xorl %r10d, %r10d
movq %rbx, %r11
testl %eax, %eax
jle 0x11eaa
xorl %r15d, %r15d
xorps %xmm0, %xmm0
cvtsi2sdl (%rdi,%r15,4), %xmm0
movsd %xmm0, (%r11,%r15,8)
incq %r15
cmpq %r15, %rax
jne 0x11e93
incq %r10
addq %r8, %r11
addq %r9, %rdi
cmpq %rcx, %r10
jne 0x11e8c
cmpl $0x5, %esi
ja 0x11f13
movl $0x26, %edi
btl %esi, %edi
jae 0x11f13
testl %ecx, %ecx
jle 0x11f13
movq 0x2b60(%r14), %rsi
leaq (,%rax,8), %rdi
leaq (%rax,%rax), %r8
xorl %r9d, %r9d
movq %rbx, %r10
testl %eax, %eax
jle 0x11f05
xorl %r11d, %r11d
movzwl (%rsi,%r11,2), %ebp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, (%r10,%r11,8)
incq %r11
cmpq %r11, %rax
jne 0x11eeb
incq %r9
addq %rdi, %r10
addq %r8, %rsi
cmpq %rcx, %r9
jne 0x11ee4
cmpl $0x2, %edx
je 0x11f85
cmpl $0x5, %edx
je 0x11fe4
cmpl $0xa, %edx
jne 0x12039
testl %ecx, %ecx
jle 0x11f77
movq 0x2b58(%r14), %rsi
leaq (,%rax,8), %rdi
leaq (,%rax,4), %r8
xorl %r9d, %r9d
movq %rbx, %r10
testl %eax, %eax
jle 0x11f69
xorl %r11d, %r11d
xorps %xmm0, %xmm0
cvtsi2sdl (%rsi,%r11,4), %xmm0
movsd %xmm0, (%r10,%r11,8)
incq %r11
cmpq %r11, %rax
jne 0x11f52
incq %r9
addq %rdi, %r10
addq %r8, %rsi
cmpq %rcx, %r9
jne 0x11f4b
cmpl $0x5, %edx
je 0x11fe4
cmpl $0x2, %edx
jne 0x12039
testl %ecx, %ecx
jle 0x11fd1
movq 0x2b60(%r14), %rsi
leaq (,%rax,8), %rdi
leaq (%rax,%rax), %r8
xorl %r9d, %r9d
movq %rbx, %r10
testl %eax, %eax
jle 0x11fc3
xorl %r11d, %r11d
movzwl (%rsi,%r11,2), %ebp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, (%r10,%r11,8)
incq %r11
cmpq %r11, %rax
jne 0x11fa9
incq %r9
addq %rdi, %r10
addq %r8, %rsi
cmpq %rcx, %r9
jne 0x11fa2
cmpl $0x5, %edx
sete %dl
testl %ecx, %ecx
setg %sil
testb %sil, %dl
jne 0x11fe8
jmp 0x12039
testl %ecx, %ecx
jle 0x12039
cmpl $0x2, %ecx
movl $0x1, %edx
cmovgel %ecx, %edx
movq 0x2b68(%r14), %rcx
leaq (,%rax,8), %rsi
xorl %edi, %edi
movsd 0x309c(%rip), %xmm0     # 0x150a8
testl %eax, %eax
jle 0x1202b
xorl %r8d, %r8d
movsd (%rcx,%r8,8), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rbx,%r8,8)
incq %r8
cmpq %r8, %rax
jne 0x12013
incq %rdi
addq %rsi, %rbx
addq %rsi, %rcx
cmpq %rdx, %rdi
jne 0x1200c
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq