LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/centroid.cc
// Function: d2_centroid(int, int, double**, int, double**, double*, double*, double**, double*, double**, double*)
void d2_centroid(int N, int row_length, double** freq, int num_nt,
double** freq_1, double* centroid, double* centroid_tilde, 
double **quality, double *expected_qual, double **quality_1,
double *expected_freq)
{
	// add the total counts
	memset(centroid, 0, row_length * sizeof(*centroid));
	for(int n=0; n<N; ++n){
		for(int l=0; l<row_length; ++l){
			centroid[l] += quality[n][l];
		}
	}
	// now normalize the entries
	double total_sq_count = 0;
	for(int l=0; l<row_length; ++l){
		total_sq_count += centroid[l] * centroid[l];
	}
	double norm = sqrt(total_sq_count);
	for(int l=0; l<row_length; ++l){
		centroid[l] /= norm;
	}
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %r9, %rbx
movl %esi, %ebp
movl %edi, %r14d
movslq %esi, %rdx
shlq $0x3, %rdx
movq %r9, %rdi
xorl %esi, %esi
callq 0x2130
movl %ebp, %r15d
testl %r14d, %r14d
jle 0x5357
movq 0x38(%rsp), %rax
movl %r14d, %ecx
xorl %edx, %edx
testl %ebp, %ebp
jle 0x534f
movq (%rax,%rdx,8), %rsi
xorl %edi, %edi
movsd (%rsi,%rdi,8), %xmm0
addsd (%rbx,%rdi,8), %xmm0
movsd %xmm0, (%rbx,%rdi,8)
incq %rdi
cmpq %rdi, %r15
jne 0x5338
incq %rdx
cmpq %rcx, %rdx
jne 0x532e
testl %ebp, %ebp
jle 0x53a7
xorpd %xmm0, %xmm0
xorl %eax, %eax
movsd (%rbx,%rax,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rax
cmpq %rax, %r15
jne 0x5361
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x5386
sqrtsd %xmm0, %xmm0
jmp 0x538b
callq 0x2170
testl %ebp, %ebp
jle 0x53a7
xorl %eax, %eax
movsd (%rbx,%rax,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rbx,%rax,8)
incq %rax
cmpq %rax, %r15
jne 0x5391
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/centroid.cc
// Function: kl_centroid(int, int, double**, int, double**, double*, double*, double**, double*, double**, double*)
void kl_centroid(int N, int row_length, double** freq, int num_nt,
double** freq_1, double* centroid, double* centroid_tilde, 
double **quality, double *expected_qual, double **quality_1,
double *expected_freq)
{
	// add the total counts
	memset(centroid, 0, row_length * sizeof(*centroid));
	for(int n=0; n<N; ++n){
		for(int l=0; l<row_length; ++l){
			centroid[l] += quality[n][l];
		}
	}
	// now normalize the entries
	double total_count = 0;
	for(int l=0; l<row_length; ++l){
		total_count += centroid[l];
	}
	for(int l=0; l<row_length; ++l){
		centroid[l] /= total_count;
	}
	return;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %r9, %rbx
movl %esi, %ebp
movl %edi, %r14d
movslq %esi, %rdx
shlq $0x3, %rdx
movq %r9, %rdi
xorl %esi, %esi
callq 0x2130
movl %ebp, %eax
testl %r14d, %r14d
jle 0x540d
movq 0x28(%rsp), %rcx
movl %r14d, %edx
xorl %esi, %esi
testl %ebp, %ebp
jle 0x5405
movq (%rcx,%rsi,8), %rdi
xorl %r8d, %r8d
movsd (%rdi,%r8,8), %xmm0
addsd (%rbx,%r8,8), %xmm0
movsd %xmm0, (%rbx,%r8,8)
incq %r8
cmpq %r8, %rax
jne 0x53eb
incq %rsi
cmpq %rdx, %rsi
jne 0x53e0
testl %ebp, %ebp
jle 0x5440
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
addsd (%rbx,%rcx,8), %xmm0
incq %rcx
cmpq %rcx, %rax
jne 0x5417
testl %ebp, %ebp
jle 0x5440
xorl %ecx, %ecx
movsd (%rbx,%rcx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rbx,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x542a
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/centroid.cc
// Function: d2ast_centroid(int, int, double**, int, double**, double*, double*, double**, double*, double**, double*)
void d2ast_centroid(int N, int row_length, double** freq, int num_nt,
double** freq_1, double* centroid, double* centroid_tilde, 
double **quality, double *expected_qual, double **quality_1,
double *expected_freq)
{
	// compute frequencies from MM
	mm_centroid(N, row_length, freq, num_nt, freq_1, centroid, NULL, 
				quality, expected_qual, quality_1, expected_freq);
	// compute X_tilde
	memset(centroid_tilde, 0, row_length * sizeof(*centroid_tilde));
	
	double total_count = 0;
	for(int n=0; n<N; ++n){
		for(int l=0; l<row_length; ++l){
			centroid_tilde[l] += quality[n][l];
			total_count += freq[n][l];
		}
	}
	
	//Determines what data to use: global(expected_freq) or local(centroid)
	double * exp_freq;
	if (expected_freq==NULL) exp_freq = centroid;
	else exp_freq = expected_freq;
	
	double S = 0;
	for(int l=0; l<row_length; ++l){
		centroid_tilde[l] -= total_count * exp_freq[l] * expected_qual[l];
		centroid_tilde[l] /= sqrt(exp_freq[l] * expected_qual[l]);
		S += centroid_tilde[l] * centroid_tilde[l];
	}
	S = sqrt(S);
	for(int l=0; l<row_length; ++l){
		centroid_tilde[l] /= S;
	}
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, %r14
movq %rdx, %r15
movl %esi, %ebp
movl %edi, %r12d
movq 0xa0(%rsp), %rax
movq 0x80(%rsp), %rbx
movq %rax, 0x20(%rsp)
callq 0x5445
movslq %ebp, %rdx
shlq $0x3, %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2130
movl %ebp, %r13d
testl %r12d, %r12d
jle 0x5608
movq 0x88(%rsp), %rax
movl %r12d, %ecx
xorpd %xmm2, %xmm2
xorl %edx, %edx
testl %ebp, %ebp
jle 0x55fe
movq (%rax,%rdx,8), %rsi
movq (%r15,%rdx,8), %rdi
xorl %r8d, %r8d
movsd (%rsi,%r8,8), %xmm0
addsd (%rbx,%r8,8), %xmm0
movsd %xmm0, (%rbx,%r8,8)
addsd (%rdi,%r8,8), %xmm2
incq %r8
cmpq %r8, %r13
jne 0x55de
incq %rdx
cmpq %rcx, %rdx
jne 0x55cf
jmp 0x560c
xorpd %xmm2, %xmm2
movq 0xa0(%rsp), %rax
testq %rax, %rax
cmovneq %rax, %r14
testl %ebp, %ebp
jle 0x56eb
xorpd 0x3525(%rip), %xmm2     # 0x8b50
movq 0x90(%rsp), %r15
xorpd %xmm4, %xmm4
xorl %r12d, %r12d
xorpd %xmm3, %xmm3
movapd %xmm2, 0x30(%rsp)
movsd (%r14,%r12,8), %xmm0
mulsd %xmm2, %xmm0
mulsd (%r15,%r12,8), %xmm0
addsd (%rbx,%r12,8), %xmm0
movsd %xmm0, (%rbx,%r12,8)
movsd (%r14,%r12,8), %xmm0
mulsd (%r15,%r12,8), %xmm0
ucomisd %xmm4, %xmm0
jb 0x5678
sqrtsd %xmm0, %xmm0
jmp 0x5693
movsd %xmm3, 0x28(%rsp)
callq 0x2170
xorpd %xmm4, %xmm4
movsd 0x28(%rsp), %xmm3
movapd 0x30(%rsp), %xmm2
movsd (%rbx,%r12,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rbx,%r12,8)
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm3
incq %r12
cmpq %r12, %r13
jne 0x5644
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm3
jb 0x56c6
xorps %xmm0, %xmm0
sqrtsd %xmm3, %xmm0
jmp 0x56cf
movapd %xmm3, %xmm0
callq 0x2170
testl %ebp, %ebp
jle 0x56eb
xorl %eax, %eax
movsd (%rbx,%rax,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rbx,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x56d5
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/freqs.cc
// Function: normalize_row(double*, int)
void normalize_row(double* fv, int L)
{
	double total = 0;
	for (int l=0; l<L; l++){
		total += fv[l];	// ||fv||1
	}
	for (int l=0; l<L; l++){
		fv[l] /= total;
	}
	return;
}

// Assembly:
testl %esi, %esi
jle 0x5731
movl %esi, %eax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
addsd (%rdi,%rcx,8), %xmm0
incq %rcx
cmpq %rcx, %rax
jne 0x5708
testl %esi, %esi
jle 0x5731
xorl %ecx, %ecx
movsd (%rdi,%rcx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rdi,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x571b
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/freqs.cc
// Function: normalize_row_against(double*, double*, int)
void normalize_row_against(double* freq, double* qual, int L)
{
	double total = 0;
	for (int l=0; l<L; l++){
		total += freq[l]; // ||freq||1
	}
	for (int l=0; l<L; l++){
		qual[l] /= total;
	}
	return;
}

// Assembly:
testl %edx, %edx
jle 0x5767
movl %edx, %eax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
addsd (%rdi,%rcx,8), %xmm0
incq %rcx
cmpq %rcx, %rax
jne 0x573e
testl %edx, %edx
jle 0x5767
xorl %ecx, %ecx
movsd (%rsi,%rcx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rsi,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x5751
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/freqs.cc
// Function: normalize_row_projection(double*, double*, int)
void normalize_row_projection(double* freq, double* qual, int L)
{
	double total = 0, total_qual = 0;
	for (int l=0; l<L; l++){
		total += freq[l];
		total_qual += qual[l];
	}
	double parziale = (total - total_qual) / L;
	for (int l=0; l<L; l++){
		qual[l] += parziale;
	}
	return;
}

// Assembly:
testl %edx, %edx
jle 0x57b5
movl %edx, %eax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
xorpd %xmm1, %xmm1
addsd (%rdi,%rcx,8), %xmm0
addsd (%rsi,%rcx,8), %xmm1
incq %rcx
cmpq %rcx, %rax
jne 0x5778
testl %edx, %edx
jle 0x57b5
subsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
divsd %xmm1, %xmm0
xorl %ecx, %ecx
movsd (%rsi,%rcx,8), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsi,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x579f
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/freqs.cc
// Function: expected_frequency_p2global(int, int, int, double*, double**)
void expected_frequency_p2global(int N, int K, int L, double *expected_freq,
								double **freq_1)
{
	double nt_freq[NUM_NT];
	memset(nt_freq, 0, NUM_NT * sizeof(nt_freq[0]));
	double S=0;
	// compute frequencies of individual nucleotides
	for (int n=0; n<N; n++){
		for (int l=0; l<NUM_NT; l++){
			nt_freq[l] += freq_1[n][l]; //= count of letter l on the dataset
		}
	}
	for (int l=0; l<NUM_NT; l++)
		S += nt_freq[l];	//S = total number of letters in the dataset

	for (int l=0; l<NUM_NT; l++){
		nt_freq[l] /= S;	//Average frequency of each letter in the dataset
	}
	// compute frequencies of words using Markov model
	for(int l=0; l<L; l++){
		double p = 1;
		for(int M=1; M<L; M*=NUM_NT){
			int digit = l/M % NUM_NT;
			p *= nt_freq[digit];
		}
		expected_freq[l] = p;
	}
	return;
}

// Assembly:
movl %edx, %esi
xorpd %xmm0, %xmm0
movapd %xmm0, -0x18(%rsp)
movapd %xmm0, -0x28(%rsp)
testl %edi, %edi
jle 0x61a9
movl %edi, %eax
xorl %edx, %edx
movq (%r8,%rdx,8), %rdi
xorl %r9d, %r9d
movupd (%rdi,%r9,8), %xmm0
addpd -0x28(%rsp,%r9,8), %xmm0
movapd %xmm0, -0x28(%rsp,%r9,8)
addq $0x2, %r9
cmpq $0x4, %r9
jne 0x6183
incq %rdx
cmpq %rax, %rdx
jne 0x617c
xorpd %xmm0, %xmm0
xorl %eax, %eax
addsd -0x28(%rsp,%rax,8), %xmm0
incq %rax
cmpq $0x4, %rax
jne 0x61af
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
xorl %eax, %eax
movapd -0x28(%rsp,%rax,8), %xmm1
divpd %xmm0, %xmm1
movapd %xmm1, -0x28(%rsp,%rax,8)
addq $0x2, %rax
cmpq $0x4, %rax
jne 0x61c4
testl %esi, %esi
jle 0x6228
movl %esi, %r8d
xorl %edi, %edi
movsd 0x1e19(%rip), %xmm0     # 0x8008
movapd %xmm0, %xmm1
cmpl $0x1, %esi
je 0x621b
movl $0x1, %r9d
movapd %xmm0, %xmm1
movl %edi, %eax
xorl %edx, %edx
divl %r9d
andl $0x3, %eax
mulsd -0x28(%rsp,%rax,8), %xmm1
shll $0x2, %r9d
cmpl %esi, %r9d
jl 0x6202
movsd %xmm1, (%rcx,%rdi,8)
incq %rdi
cmpq %r8, %rdi
jne 0x61ef
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/freqs.cc
// Function: expected_frequency_p1global(int, int, int, double*, double**)
void expected_frequency_p1global(int N, int K, int L, double *expected_freq,
								double **freq)
{
	int tot_parole = 0;
	for (int l=0; l<L; l++) {
		expected_freq[l] = 0;
		for (int n=0; n<N; n++)
			expected_freq[l] += freq[n][l];
		tot_parole += expected_freq[l];
	}	
	for (int l=0; l<L; l++) {
		expected_freq[l] /= tot_parole;
	}
	return;
}

// Assembly:
testl %edx, %edx
jle 0x62a1
pushq %rbx
movl %edx, %eax
movl %edi, %esi
xorl %r9d, %r9d
xorl %r10d, %r10d
movq $0x0, (%rcx,%r9,8)
xorpd %xmm0, %xmm0
testl %edi, %edi
jle 0x6263
xorl %r11d, %r11d
movq (%r8,%r11,8), %rbx
addsd (%rbx,%r9,8), %xmm0
movsd %xmm0, (%rcx,%r9,8)
incq %r11
cmpq %r11, %rsi
jne 0x624b
xorps %xmm1, %xmm1
cvtsi2sd %r10d, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %r10d
incq %r9
cmpq %rax, %r9
jne 0x6238
testl %edx, %edx
popq %rbx
jle 0x62a1
xorps %xmm0, %xmm0
cvtsi2sd %r10d, %xmm0
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x628b
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/freqs.cc
// Function: normalize_freq_matrix(double**, double**, int, int)
void normalize_freq_matrix(double** freq, double** qual, int N, int row_length)
{
	double tmp, sum_freq, sum_freq_square, V_freq;
	double sum_qual, sum_qual_square, V_qual;
	for(int l=0; l<row_length; ++l){
		sum_freq_square=0;
		sum_freq=0;
		sum_qual_square = 0;
		sum_qual = 0;
		for(int n=0; n<N; ++n){
			tmp = *(*(freq+n)+l);
			sum_freq_square += tmp*tmp;
			sum_freq += tmp;
			tmp = *(*(qual+n)+l);
			sum_qual_square += tmp*tmp;
			sum_qual += tmp;
		}
		//Variance:
		V_freq = sqrt( sum_freq_square/N - (sum_freq*sum_freq)/(N*N) );  
		V_qual = sqrt( sum_qual_square/N - (sum_qual*sum_qual)/(N*N) ); 
		if (V_freq>0 && V_qual>0){
			for(int n=0; n<N; ++n){
				*(*(freq+n)+l) /= V_freq;
				*(*(qual+n)+l) /= V_qual;				
			}
		}
	}
	return;
}

// Assembly:
testl %ecx, %ecx
jle 0x6434
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
cvtsi2sd %edx, %xmm3
movl %edx, %eax
imull %ebx, %eax
cvtsi2sd %eax, %xmm0
unpcklpd %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0]
movl %ecx, %r12d
movl %edx, %r13d
xorl %ebp, %ebp
xorpd %xmm4, %xmm4
movapd %xmm3, 0x10(%rsp)
xorpd %xmm5, %xmm5
testl %ebx, %ebx
jle 0x6325
xorpd %xmm1, %xmm1
xorl %eax, %eax
xorpd %xmm6, %xmm6
movq (%r15,%rax,8), %rcx
movsd (%rcx,%rbp,8), %xmm0
addsd %xmm0, %xmm1
movq (%r14,%rax,8), %rcx
movsd (%rcx,%rbp,8), %xmm2
unpcklpd %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0]
mulpd %xmm0, %xmm0
addpd %xmm0, %xmm5
addsd %xmm2, %xmm6
incq %rax
cmpq %rax, %r13
jne 0x62f5
jmp 0x632d
xorpd %xmm6, %xmm6
xorpd %xmm1, %xmm1
mulsd %xmm1, %xmm1
movapd %xmm5, %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
divpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
subsd %xmm1, %xmm0
ucomisd %xmm4, %xmm0
jb 0x6358
xorps %xmm7, %xmm7
sqrtsd %xmm0, %xmm7
jmp 0x6381
movapd %xmm5, (%rsp)
movapd %xmm6, 0x20(%rsp)
callq 0x2170
movapd 0x20(%rsp), %xmm6
movapd (%rsp), %xmm5
xorpd %xmm4, %xmm4
movapd 0x10(%rsp), %xmm3
movapd %xmm0, %xmm7
mulsd %xmm6, %xmm6
shufpd $0x1, %xmm6, %xmm5      # xmm5 = xmm5[1],xmm6[0]
divpd %xmm3, %xmm5
movapd %xmm5, %xmm0
unpckhpd %xmm5, %xmm0            # xmm0 = xmm0[1],xmm5[1]
subsd %xmm0, %xmm5
ucomisd %xmm4, %xmm5
jb 0x63a9
xorps %xmm0, %xmm0
sqrtsd %xmm5, %xmm0
jmp 0x63c6
movapd %xmm5, %xmm0
movapd %xmm7, (%rsp)
callq 0x2170
movapd (%rsp), %xmm7
xorpd %xmm4, %xmm4
movapd 0x10(%rsp), %xmm3
testl %ebx, %ebx
setle %al
xorpd %xmm1, %xmm1
cmpnltpd %xmm0, %xmm1
xorpd %xmm2, %xmm2
cmpnltpd %xmm7, %xmm2
orpd %xmm1, %xmm2
movd %xmm2, %ecx
orb %al, %cl
testb $0x1, %cl
jne 0x641a
xorl %eax, %eax
movq (%r15,%rax,8), %rcx
movsd (%rcx,%rbp,8), %xmm1
divsd %xmm7, %xmm1
movsd %xmm1, (%rcx,%rbp,8)
movq (%r14,%rax,8), %rcx
movsd (%rcx,%rbp,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rcx,%rbp,8)
incq %rax
cmpq %rax, %r13
jne 0x63ee
incq %rbp
cmpq %r12, %rbp
jne 0x62e3
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/seqio.cc
// Function: SeqRecord::toupper() const
SeqRecord SeqRecord::toupper() const
{
	string upper_seq; 
	unsigned int L = sequence.length();
	upper_seq.resize(L);
	for (unsigned int i=0; i<L; i++) {
		upper_seq[i] = std::toupper(sequence[i]); // need to specify std
		// namespace explicitly to avoid conflict with our member function
	}
	return SeqRecord(header, description, upper_seq, quality);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl 0x48(%rsi), %r15d
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x20c0
testq %r15, %r15
je 0x66f1
xorl %r13d, %r13d
movq 0x40(%r14), %rax
movsbl (%rax,%r13), %edi
callq 0x2380
movq 0x8(%rsp), %rcx
movb %al, (%rcx,%r13)
incq %r13
cmpq %r13, %r15
jne 0x66d2
leaq 0x98(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %rdi
callq 0x3dd0
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rdi
callq 0x3dd0
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x3dd0
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x60(%r14), %rsi
movq 0x68(%r14), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x3dd0
leaq 0x88(%rsp), %rsi
leaq 0x68(%rsp), %rdx
leaq 0x48(%rsp), %rcx
leaq 0x28(%rsp), %r8
movq %rbx, %rdi
callq 0x6522
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x67a7
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x67be
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x67d5
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x67f2
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x680e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x6842
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x6842
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x685e
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x685e
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x687a
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x687a
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r12, %rdi
je 0x689c
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x689c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x68b8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/seqio.cc
// Function: FastqRead(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<SeqRecord, std::allocator<SeqRecord>>&)
void FastqRead(string fname, vector<SeqRecord>& recs)
{
	int N = CountReads(fname);
	RecordGenerator rec_gen(fname);
	for (int i=0; i<N; i++) {
		recs.push_back(rec_gen.next());
	}
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x310, %rsp            # imm = 0x310
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x3dd0
movq %r15, %rdi
callq 0x72ff
movl %eax, %ebp
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x7215
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rsp, %r14
movq %r14, %rdi
callq 0x3dd0
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
callq 0x6b16
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x7259
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2200
testl %ebp, %ebp
jle 0x728c
leaq 0x40(%rsp), %r14
leaq 0xc0(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x6c02
movq %rbx, %rdi
movq %r14, %rsi
callq 0x745c
movq %r14, %rdi
callq 0x6626
decl %ebp
jne 0x726a
leaq 0xc0(%rsp), %rdi
callq 0x6bb8
addq $0x310, %rsp            # imm = 0x310
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x72f7
movq 0x10(%rsp), %rsi
jmp 0x72ce
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x72f7
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x72f7
movq %rax, %rbx
jmp 0x72ea
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x6626
leaq 0xc0(%rsp), %rdi
callq 0x6bb8
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/seqio.cc
// Function: CountReads(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int CountReads(string fname)
{
	int num_reads = 0;
	int indice_riga = 0;
	string line="";
	
	ifstream ifs(fname.c_str());
	
	//Skip rows until first "@" character
	while (ifs.good() && (!line.length() || line[0] != '@')) {
		getline(ifs, line);
	}
	
	while (ifs.good()) {
		indice_riga = (indice_riga+1) % 4;
		if (indice_riga % 4 == 0) num_reads++;	//Couno 1 read every 4 row
		getline(ifs, line);
	}
	
	return num_reads;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdi, %rbx
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x17d2(%rip), %rdx      # 0x8af6
movq %rsp, %rdi
movq %rdx, %rsi
callq 0x3e66
movq (%rbx), %rsi
leaq 0x20(%rsp), %rdi
movl $0x8, %edx
callq 0x2360
leaq 0x20(%rsp), %rbx
movq %rsp, %r14
movq 0x20(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x40(%rsp,%rax)
jne 0x738c
cmpq $0x0, 0x8(%rsp)
je 0x736a
movq (%rsp), %rcx
cmpb $0x40, (%rcx)
je 0x738c
leaq (%rsp,%rax), %rdi
addq $0x20, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2370
jmp 0x7349
xorl %ebx, %ebx
leaq 0x20(%rsp), %r14
movq %rsp, %r15
xorl %r13d, %r13d
movq 0x20(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x40(%rsp,%rax)
jne 0x73ea
leaq (%rsp,%rax), %rdi
addq $0x20, %rdi
movl $0xa, %esi
callq 0x21e0
leal 0x1(%r13), %ebp
addl $0x4, %r13d
testl %ebp, %ebp
cmovnsl %ebp, %r13d
andl $-0x4, %r13d
xorl %ecx, %ecx
subl %r13d, %ebp
sete %cl
addl %ecx, %ebx
movsbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2370
movl %ebp, %r13d
jmp 0x7399
leaq 0x20(%rsp), %rdi
callq 0x2090
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x740a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2200
movl %ebx, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x7432
jmp 0x7425
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2090
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x7448
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/baseAccelSim.cc
// Function: baseAccelSim::read_data_operand(unsigned char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void baseAccelSim::read_data_operand(uint8_t op, string fileName) {
	ifstream inFile(fileName.c_str());
	if(!inFile)
	{
		cout << "Cannot open and read file: " << fileName.c_str() << endl;
		exit (EXIT_FAILURE);
	}

	for(int i=0; i < size_tensors[op]; i++) {
		inFile >> tensor_operands[op][i];
	}
	inFile.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rdx, %rbx
movl %esi, %ebp
movq (%rdx), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x461750
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x28(%rsp,%rax)
jne 0x408d52
movzbl %bpl, %r14d
movq 0x20287e(%rip), %rax    # 0x60b570
cmpq $0x0, (%rax,%r14,8)
je 0x408d2e
xorl %r15d, %r15d
leaq 0x8(%rsp), %rbx
xorl %r12d, %r12d
movq 0x202855(%rip), %rax    # 0x60b560
movq (%rax,%r14,8), %rsi
addq %r15, %rsi
movq %rbx, %rdi
callq 0x46b150
incq %r12
movq 0x20284c(%rip), %rax    # 0x60b570
addq $0x2, %r15
cmpq %r12, (%rax,%r14,8)
ja 0x408d04
leaq 0x8(%rsp), %rdi
callq 0x461d00
leaq 0x8(%rsp), %rdi
callq 0x4620b0
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq $0x60c900, %rdi         # imm = 0x60C900
leaq 0x18b2c0(%rip), %rsi    # 0x594020
movl $0x1b, %edx
callq 0x484db0
movq (%rbx), %rsi
movq $0x60c900, %rdi         # imm = 0x60C900
callq 0x4852e0
movq %rax, %rdi
callq 0x484bc0
movl $0x1, %edi
callq 0x4def10
jmp 0x408d8d
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4620b0
movq %rbx, %rdi
callq 0x4c34a0
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/baseAccelSim.cc
// Function: baseAccelSim::write_data_operand(unsigned char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void baseAccelSim::write_data_operand(uint8_t op, string fileName)
{
	std::ofstream outFile;
  outFile.open (fileName.c_str(), std::ofstream::out | std::ofstream::trunc);

	for(uint64_t idx = 0; idx < size_tensors[op]; idx++)
    outFile << tensor_operands[op][idx] << "\n";

	outFile.close();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdx, %r14
movl %esi, %ebx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x4603c0
movq (%r14), %rsi
movq %r15, %rdi
movl $0x30, %edx
callq 0x460ce0
movzbl %bl, %r15d
movq 0x20240d(%rip), %rax    # 0x60b570
cmpq $0x0, (%rax,%r15,8)
je 0x4091b1
xorl %r12d, %r12d
leaq 0x8(%rsp), %rbx
leaq 0x194cd1(%rip), %r14    # 0x59de4a
movq 0x2023e0(%rip), %rax    # 0x60b560
movq (%rax,%r15,8), %rax
movzwl (%rax,%r12,2), %esi
movq %rbx, %rdi
callq 0x4856b0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x484db0
incq %r12
movq 0x2023c5(%rip), %rax    # 0x60b570
cmpq (%rax,%r15,8), %r12
jb 0x409179
leaq 0x8(%rsp), %rdi
callq 0x461d40
movq $0x604c08, %rax         # imm = 0x604C08
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x10(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x8(%rsp,%rcx)
callq 0x45ffd0
leaq 0x100(%rsp), %rdi
callq 0x467320
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x4091fe
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x461f70
movq %rbx, %rdi
callq 0x4c34a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/baseAccelSim.cc
// Function: baseAccelSim::compare_golden_outputs()
void baseAccelSim::compare_golden_outputs()
{
	if(compare_golden)
	{
		read_golden_outputs();

		for(uint8_t op=(total_operands-output_operands); op < total_operands; op++)
		{
			for(int i=0; i < size_tensors[op]; i++)
			{
				if(golden_outputs[op-input_operands][i] - tensor_operands[op][i] > 0.001)
				{
					printf("Operand %d: Golden output does not match with generated output.\n", op);
					exit (EXIT_FAILURE);
				}
			}
		}
		cout << "Generated output operands consist of expected values.\n";
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpb $0x1, 0x2023a4(%rip)    # 0x60b980
jne 0x409672
callq 0x409214
movzbl 0x201f68(%rip), %eax    # 0x60b556
movl %eax, %esi
subb 0x201f60(%rip), %sil    # 0x60b557
cmpb %al, %sil
jae 0x409654
movq 0x201f6d(%rip), %rcx    # 0x60b570
movq 0x201f5e(%rip), %rdx    # 0x60b568
movzbl 0x201f47(%rip), %edi    # 0x60b558
movq 0x201f48(%rip), %r8     # 0x60b560
movzbl %sil, %esi
movq (%rcx,%rsi,8), %r9
testq %r9, %r9
je 0x40964c
movl %esi, %r10d
subl %edi, %r10d
movslq %r10d, %r10
movq (%rdx,%r10,8), %r10
movq (%r8,%rsi,8), %r11
xorl %ebx, %ebx
movzwl (%r10,%rbx,2), %ebp
cmpw (%r11,%rbx,2), %bp
ja 0x409679
incq %rbx
cmpq %rbx, %r9
jne 0x409638
incq %rsi
cmpq %rax, %rsi
jne 0x40961c
movq $0x60c900, %rdi         # imm = 0x60C900
leaq 0x18ba48(%rip), %rsi    # 0x5950aa
movl $0x36, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x484db0
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x18b9e9(%rip), %rdi    # 0x595069
xorl %eax, %eax
callq 0x4ea1e0
movl $0x1, %edi
callq 0x4def10
nop
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/baseAccelSim.cc
// Function: baseAccelSim::read_file_instns(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void baseAccelSim::read_file_instns(string fileName)
{
	ifstream inFile(fileName.c_str());
	if(!inFile)
	{
		cout << "Cannot open and read file: " << fileName.c_str() << endl;
		exit (EXIT_FAILURE);
	}

	string line;
	while (getline(inFile,line))
  {
		instArr.push_back(stoull(line));
  }
  inFile.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rsi, %rbx
movq (%rsi), %rsi
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x461750
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x50(%rsp,%rax)
jne 0x40c3a6
leaq 0x10(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
leaq 0x30(%rsp), %rbx
movq %rsp, %r14
leaq 0x28(%rsp), %r15
leaq (%rsp,%rax), %rdi
addq $0x30, %rdi
movl $0xa, %esi
callq 0x465f00
movsbl %al, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x41aa00
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x40c34d
movq (%rsp), %r12
callq 0x4c85e0
movq %rax, %rbp
movl (%rax), %r13d
movl $0x0, (%rax)
movq %r12, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x4df260
cmpq %r12, 0x28(%rsp)
je 0x40c38e
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x40c305
cmpl $0x22, %ecx
jne 0x40c309
jmp 0x40c39a
movl %r13d, (%rbp)
movq %rax, 0x20(%rsp)
movq 0x1ff31b(%rip), %rsi    # 0x60b630
cmpq 0x1ff31c(%rip), %rsi    # 0x60b638
je 0x40c32e
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x1ff304(%rip)    # 0x60b630
jmp 0x40c33f
leaq 0x1ff2f3(%rip), %rdi    # 0x60b628
leaq 0x20(%rsp), %rdx
callq 0x40ee9e
movq 0x30(%rsp), %rax
movq -0x18(%rax), %rax
jmp 0x40c292
leaq 0x30(%rsp), %rdi
callq 0x461d00
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x40c372
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4177e0
leaq 0x30(%rsp), %rdi
callq 0x4620b0
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18963c(%rip), %rdi    # 0x5959d1
callq 0x402b51
leaq 0x189630(%rip), %rdi    # 0x5959d1
callq 0x402c01
movq $0x60c900, %rdi         # imm = 0x60C900
leaq 0x187c6c(%rip), %rsi    # 0x594020
movl $0x1b, %edx
callq 0x484db0
movq (%rbx), %rsi
movq $0x60c900, %rdi         # imm = 0x60C900
callq 0x4852e0
movq %rax, %rdi
callq 0x484bc0
movl $0x1, %edi
callq 0x4def10
movq %rax, %rbx
jmp 0x40c415
jmp 0x40c3f7
jmp 0x40c3f7
movq %rax, %rbx
cmpl $0x0, (%rbp)
jne 0x40c3fa
movl %r13d, (%rbp)
jmp 0x40c3fa
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x40c415
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4177e0
leaq 0x30(%rsp), %rdi
callq 0x4620b0
movq %rbx, %rdi
callq 0x4c34a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/baseAccelSim.cc
// Function: main
int main(int argc, const char** argv)
{
	baseAccelSim accel;

	// parse arguments from command line
	parse_arguments(argc, argv);

	accel.read_inputs();
	accel.read_data();
	accel.read_accel_configurations();

	controller accelController;
	accelController.run(tensor_operands);

	printf("Done!! ticks are: %ld \n",tick);
	accel.write_data();
	accel.compare_golden_outputs();
	accel.free_memory();

	return 0;
}

// Assembly:
pushq %rbx
subq $0x130, %rsp            # imm = 0x130
callq 0x4127c0
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x404c40
movq %rbx, %rdi
callq 0x40893e
callq 0x40d02e
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x40efdc
movq 0x1fd5e2(%rip), %rsi    # 0x60b560
movq %rbx, %rdi
callq 0x40fc8a
movq 0x1fd68b(%rip), %rsi    # 0x60b618
leaq 0x187a15(%rip), %rdi    # 0x5959a9
xorl %eax, %eax
callq 0x4ea1e0
leaq 0x8(%rsp), %rdi
callq 0x408da2
callq 0x4095d2
callq 0x40d43c
leaq 0x10(%rsp), %rdi
callq 0x40f852
xorl %eax, %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbx
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x40f852
movq %rbx, %rdi
callq 0x4c34a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/controller.cc
// Function: controller::controller()
controller::controller()
{
  setup_PEs();
  setup_interconnect();
  setup_DMAC();
  setup_scratchpad();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x1f28f1(%rip), %rax    # 0x6018d8
movq %rax, (%rdi)
movw $0x0, 0xa0(%rdi)
xorl %eax, %eax
movb %al, 0xb8(%rdi)
movb $0x1, 0xc8(%rdi)
movl %eax, 0xc9(%rdi)
movb %al, 0xcd(%rdi)
movw $0x101, 0xce(%rdi)      # imm = 0x101
movl %eax, 0xd0(%rdi)
movl %eax, 0xf8(%rdi)
callq 0x40f042
movq %rbx, %rdi
callq 0x40f350
movq %rbx, %rdi
callq 0x40f7a8
movq %rbx, %rdi
popq %rbx
jmp 0x40f80e
nop
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/controller.cc
// Function: controller::reconfigure()
void controller::reconfigure()
{
  // One-time configuration of PEs
  for(uint16_t i=0; i < nRows_PE_Array; i++) {
    for(uint16_t j=0; j < nCols_PE_Array; j++) {
      PEs[i][j].setInsMem();
    }
  }

  current_SPM_pass = 0;
  current_RF_pass = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq $0x60b5ac, %r14         # imm = 0x60B5AC
movzwl (%r14), %ecx
testw %cx, %cx
je 0x40fc64
movq %rdi, %rbx
movq $0x60b5ae, %r15         # imm = 0x60B5AE
movzwl (%r15), %eax
xorl %r12d, %r12d
testw %ax, %ax
je 0x40fc57
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x8(%rbx), %rax
movq (%rax,%r12,8), %rdi
addq %r13, %rdi
callq 0x41745a
incq %rbp
movzwl (%r15), %eax
addq $0x148, %r13            # imm = 0x148
cmpq %rax, %rbp
jb 0x40fc2e
movzwl (%r14), %ecx
jmp 0x40fc59
xorl %eax, %eax
incq %r12
movzwl %cx, %edx
cmpq %rdx, %r12
jb 0x40fc24
movq $0x60b73a, %rax         # imm = 0x60B73A
xorl %ecx, %ecx
movw %cx, (%rax)
movq $0x60b738, %rax         # imm = 0x60B738
movw %cx, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/controller.cc
// Function: controller::run(unsigned short**)
void controller::run(data_type **tensor_operands)
{
  // reset configurations and counters
  reconfigure();

  while(!isFinished)
  {
    execute_controller_pre_tick();

    // execute networks for oututting data from PE array.
    // Controller reads data first, then output network should over-write
    // new data at the end of the tick.
    for(uint8_t i=0; i < outNetworks; i++) {
      network_outputs[i].execute();
    }

    // execute PEs
    for(uint16_t i=0; i < nRows_PE_Array; i++) {
  		for(uint16_t j=0; j < nCols_PE_Array; j++) {
  			PEs[i][j].executeAtTick();
  		}
  	}

    // execute networks for inputting data to PE array.
    // network reads data first, then controller should over-write
    // new data at the end of the tick.
    for(uint8_t i=0; i < inNetworks; i++) {
      network_inputs[i].execute();
    }

    // DMA controller advances its tick.
    DMAC->execute_tick();

    // execute controller logic
    advanceExecutionAtTick();

    // Update the global tick (cycle number).
    advanceTick();
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x40fbf8
cmpb $0x0, 0xa0(%rbx)
jne 0x40fdad
movq $0x60b5e4, %r13         # imm = 0x60B5E4
movq $0x609151, %r12         # imm = 0x609151
movq $0x60b5ae, %rbp         # imm = 0x60B5AE
movq %rbx, %rdi
callq 0x40fdbc
cmpb $0x0, (%r13)
je 0x40fcf4
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0x88(%rbx), %rdi
addq %r15, %rdi
callq 0x4126a0
incq %r14
movzbl (%r13), %eax
addq $0x10, %r15
cmpq %rax, %r14
jb 0x40fcd4
movq $0x60b5ac, %rax         # imm = 0x60B5AC
movzwl (%rax), %ecx
testw %cx, %cx
je 0x40fd51
movzwl (%rbp), %eax
xorl %r13d, %r13d
testw %ax, %ax
je 0x40fd44
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r13,8), %rdi
addq %r15, %rdi
callq 0x416b52
incq %r14
movzwl (%rbp), %eax
addq $0x148, %r15            # imm = 0x148
cmpq %rax, %r14
jb 0x40fd15
movq $0x60b5ac, %rcx         # imm = 0x60B5AC
movzwl (%rcx), %ecx
jmp 0x40fd46
xorl %eax, %eax
incq %r13
movzwl %cx, %edx
cmpq %rdx, %r13
jb 0x40fd0a
cmpb $0x0, (%r12)
je 0x40fd7b
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x50(%rbx), %rdi
addq %r14, %rdi
callq 0x4115c2
incq %r15
movzbl (%r12), %eax
addq $0x10, %r14
cmpq %rax, %r15
jb 0x40fd5e
movq 0xa8(%rbx), %rdi
callq 0x4111ce
movq %rbx, %rdi
callq 0x40fe3a
movq $0x60b618, %rax         # imm = 0x60B618
incq (%rax)
cmpb $0x0, 0xa0(%rbx)
movq $0x60b5e4, %r13         # imm = 0x60B5E4
je 0x40fcbf
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/controller.cc
// Function: controller::execute_controller_pre_tick()
void controller::execute_controller_pre_tick()
{
  bus_req_DMA = false;

  // reset only if ack is received.
  data_mov_SPM_DRAM_in_prog = (*bus_ack_from_DMA == true) ? false : data_mov_SPM_DRAM_in_prog;

  for(uint8_t network=0; network < outNetworks; network++)
    is_data_collected[network] = collect_data_via_write_network(network, collected_data + network);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movb $0x0, 0xb8(%rdi)
movq 0xc0(%rdi), %rax
movzbl 0xc9(%rdi), %ecx
xorl %edx, %edx
cmpb $0x0, (%rax)
cmovel %ecx, %edx
movb %dl, 0xc9(%rdi)
movq $0x60b5e4, %r14         # imm = 0x60B5E4
cmpb $0x0, (%r14)
je 0x40fe2e
movq %rdi, %rbx
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x118(%rbx), %rdx
addq %r15, %rdx
movzbl %r12b, %esi
movq %rbx, %rdi
callq 0x410732
movq 0x110(%rbx), %rcx
movb %al, (%rcx,%r12)
incq %r12
movzbl (%r14), %eax
addq $0x2, %r15
cmpq %rax, %r12
jb 0x40fdfd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/controller.cc
// Function: controller::advanceExecutionAtTick()
void controller::advanceExecutionAtTick()
{
  if (acc_controller_state == init)
  {
    initialize();
  }
  else if (acc_controller_state == config_NoC)
  {
    configure_interconnect();
  }
  else if (acc_controller_state == exec_kernel)
  {
    execute_SPM_pass();
    execute_RF_pass();
  }
  else if(acc_controller_state == terminate_exec)
  {
    for(auto i=0; i < nRows_PE_Array; i++)
      for(auto j=0; j < nCols_PE_Array; j++)
        bus_trigger_PEs_exec[i][j] = 0;

    // acc_controller_state = terminate_exec;
    for(uint8_t i=0; i < inNetworks; i++)
    {
      configNetwork[i] = 0;
      forwardDataToNetwork[i] = 0;
      dataOutToNetwork[i] = 0;
    }
    isFinished = 1;
  }
  else
    assert("Undefined state for accelerator execution!");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq $0x60b620, %rax         # imm = 0x60B620
movl (%rax), %eax
cmpq $0x3, %rax
ja 0x40ff0f
movq %rdi, %rbx
leaq 0x185c9c(%rip), %rcx    # 0x595afc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x41048c
movq %rbx, %rdi
callq 0x40ff36
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x41061a
movq $0x60b5ac, %rax         # imm = 0x60B5AC
movzwl (%rax), %r15d
testq %r15, %r15
je 0x40fed0
movq $0x60b5ae, %rax         # imm = 0x60B5AE
movzwl (%rax), %r14d
movq 0x10(%rbx), %r12
xorl %r13d, %r13d
testq %r14, %r14
je 0x40fec8
movq (%r12,%r13,8), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x401088
incq %r13
cmpq %r13, %r15
jne 0x40feb5
movq $0x609151, %rax         # imm = 0x609151
cmpb $0x0, (%rax)
je 0x40ff08
movq 0x58(%rbx), %rcx
movq 0x60(%rbx), %rdx
movq 0x68(%rbx), %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movb %dil, (%rcx,%r8)
movb %dil, (%rdx,%r8)
movw $0x0, (%rsi,%r8,2)
incq %r8
movzbl (%rax), %r9d
cmpq %r9, %r8
jb 0x40feed
movb $0x1, 0xa0(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x410522
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/controller.cc
// Function: controller::initialize()
void controller::initialize()
{
  for(uint8_t i=0; i < totalNetworks; i++)
    cnt_data_distribution[i] = 0;
  acc_controller_state = config_NoC;

  for(uint8_t i=0; i < total_operands; i++) {
    spm_buffer_number_op_prefetch[i] = 1;
    spm_buffer_number_op_writeback[i] = 1;
    spm_buffer_number_op_comp_read[i] = 0;
    spm_buffer_number_op_comp_write[i] = 0;
  }

  PE_prefetch_RF_incomplete = true;
  PE_writeback_RF_incomplete = true;
}

// Assembly:
pushq %rbx
movq $0x609153, %rax         # imm = 0x609153
cmpb $0x0, (%rax)
je 0x4104b3
movq 0x80(%rdi), %rcx
xorl %edx, %edx
movw $0x0, (%rcx,%rdx,2)
incq %rdx
movzbl (%rax), %esi
cmpq %rsi, %rdx
jb 0x4104a2
movq $0x60b620, %rax         # imm = 0x60B620
movl $0x1, (%rax)
movq $0x60b556, %rax         # imm = 0x60B556
cmpb $0x0, (%rax)
je 0x410517
xorl %ecx, %ecx
movq $0x60b718, %rdx         # imm = 0x60B718
movb $0x1, %sil
movq $0x60b720, %r8          # imm = 0x60B720
movq $0x60b728, %r9          # imm = 0x60B728
movq $0x60b730, %r10         # imm = 0x60B730
xorl %r11d, %r11d
movq (%rdx), %rbx
movb %sil, (%rbx,%r11)
movq (%r8), %rbx
movb %sil, (%rbx,%r11)
movq (%r9), %rbx
movb %cl, (%rbx,%r11)
movq (%r10), %rbx
movb %cl, (%rbx,%r11)
incq %r11
movzbl (%rax), %ebx
cmpq %rbx, %r11
jb 0x4104f0
movw $0x101, 0xce(%rdi)      # imm = 0x101
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/controller.cc
// Function: controller::configure_interconnect()
void controller::configure_interconnect()
{
  for(uint8_t i=0; i < totalNetworks; i++)
  {
    configNetwork[i] = 1;
    // 4 is total elements in configArr packet
    uint32_t idxRow = cnt_data_distribution[i] / network_controller_config_params;
    uint16_t idxCol = cnt_data_distribution[i] % network_controller_config_params;
    if(cnt_data_distribution[i] >= nRows_PE_Array*network_controller_config_params)
      forwardDataToNetwork[i] = 1;
    else
      forwardDataToNetwork[i] = 0;

    rowTagDataToNetwork[i] = configArr[i][idxRow][idxCol].getRowTag();
    colTagDataToNetwork[i] = configArr[i][idxRow][idxCol].getColTag();
    dataOutToNetwork[i]    = configArr[i][idxRow][idxCol].getData();

    cnt_data_distribution[i]++;

    // all networks are configured simultanously
    // so controller does not need to sync-up or wait for a specific network
    if(cnt_data_distribution[i] == total_MC*network_controller_config_params)
    {
      cnt_data_distribution[i] = 0;
      acc_controller_state = exec_kernel;
    }
  }
}

// Assembly:
pushq %r14
pushq %rbx
movq $0x609153, %rax         # imm = 0x609153
cmpb $0x0, (%rax)
je 0x410615
movq 0x80(%rdi), %r10
xorl %ecx, %ecx
movq $0x60b5ac, %rdx         # imm = 0x60B5AC
movq $0x60b600, %rsi         # imm = 0x60B600
movq $0x60b610, %r8          # imm = 0x60B610
movq $0x60b620, %r9          # imm = 0x60B620
movq 0x58(%rdi), %r11
movb $0x1, (%r11,%rcx)
movzwl (%r10,%rcx,2), %r10d
movl %r10d, %r11d
andl $0x3, %r11d
movzwl (%rdx), %ebx
shll $0x2, %ebx
cmpl %r10d, %ebx
movq 0x60(%rdi), %rbx
setbe (%rbx,%rcx)
movq (%rsi), %rbx
movq (%rbx,%rcx,8), %rbx
addl %r10d, %r10d
andl $-0x8, %r10d
movq (%rbx,%r10), %rbx
shll $0x2, %r11d
movb (%rbx,%r11), %bl
movq 0x70(%rdi), %r14
movb %bl, (%r14,%rcx)
movq (%rsi), %rbx
movq (%rbx,%rcx,8), %rbx
movq (%rbx,%r10), %rbx
movb 0x1(%rbx,%r11), %bl
movq 0x78(%rdi), %r14
movb %bl, (%r14,%rcx)
movq (%rsi), %rbx
movq (%rbx,%rcx,8), %rbx
movq (%rbx,%r10), %r10
movzwl 0x2(%r10,%r11), %r10d
movq 0x68(%rdi), %r11
movw %r10w, (%r11,%rcx,2)
movq 0x80(%rdi), %r10
movzwl (%r10,%rcx,2), %r11d
incl %r11d
movw %r11w, (%r10,%rcx,2)
movzwl %r11w, %r11d
movl (%r8), %ebx
shll $0x2, %ebx
cmpl %r11d, %ebx
jne 0x410605
movw $0x0, (%r10,%rcx,2)
movl $0x2, (%r9)
incq %rcx
movzbl (%rax), %r11d
cmpq %r11, %rcx
jb 0x41055a
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/controller.cc
// Function: controller::execute_RF_pass()
void controller::execute_RF_pass()
{
  // DMA prefetches data in 0th SPM pass.
  // Networks and PEs are already configured.
  // No need to configure networks further or communicate data.
  if(current_SPM_pass == 0)
  {
    for(uint8_t i=0; i < inNetworks; i++)
    {
      configNetwork[i] = 0;
      forwardDataToNetwork[i] = 0;
    }
  }

  if(current_SPM_pass > 0 && current_SPM_pass < SPM_passes + 1)
  {
    trigger_PEs();
    if ((current_RF_pass >= RF_passes) && (current_RF_pass < RF_passes + WB_delay_RF_pass))
    {
      // don't process read operands. need to process write operands
      if(PE_writeback_RF_incomplete)
        write_back_controller(current_RF_pass);
      else
        inc_RF_pass();
    }
    else if (current_RF_pass < WB_delay_RF_pass)
    {
      // don't process write operands. need to process read operands
      if(PE_prefetch_RF_incomplete)
        prefetch_to_PE(current_RF_pass);
      else
        inc_RF_pass();
    }
    else if((current_RF_pass >= WB_delay_RF_pass) && (current_RF_pass < RF_passes))
    {
      // process both read operands and write operands
      if(PE_prefetch_RF_incomplete)
        prefetch_to_PE(current_RF_pass);
      if (PE_writeback_RF_incomplete)
        write_back_controller(current_RF_pass);

      if ((PE_prefetch_RF_incomplete == 0) && (PE_writeback_RF_incomplete == 0))
        inc_RF_pass();
    }
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq $0x60b73a, %rax         # imm = 0x60B73A
movzwl (%rax), %eax
testw %ax, %ax
jne 0x41065d
movq $0x609151, %rcx         # imm = 0x609151
cmpb $0x0, (%rcx)
je 0x41065d
movq 0x58(%rbx), %rdx
movq 0x60(%rbx), %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movb %dil, (%rdx,%r8)
movb %dil, (%rsi,%r8)
incq %r8
movzbl (%rcx), %r9d
cmpq %r9, %r8
jb 0x410649
movq $0x60b554, %rcx         # imm = 0x60B554
decl %eax
cmpw (%rcx), %ax
jae 0x410729
movq %rbx, %rdi
callq 0x410790
movq $0x60b738, %r14         # imm = 0x60B738
movzwl (%r14), %eax
movq $0x60b552, %rcx         # imm = 0x60B552
movzwl (%rcx), %ecx
cmpw %cx, %ax
setae %dl
movzwl %cx, %edi
movzwl %ax, %esi
addl $0x2, %edi
cmpl %esi, %edi
seta %dil
andb %dl, %dil
cmpb $0x1, %dil
jne 0x4106c2
cmpb $0x1, 0xcf(%rbx)
jne 0x41071a
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x410af4
cmpw $0x1, %ax
ja 0x4106e0
cmpb $0x1, 0xce(%rbx)
jne 0x41071a
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x410d50
cmpw %cx, %ax
jae 0x410729
cmpb $0x1, 0xce(%rbx)
jne 0x4106f6
movq %rbx, %rdi
callq 0x410d50
movb 0xcf(%rbx), %al
cmpb $0x1, %al
jne 0x410712
movzwl (%r14), %esi
movq %rbx, %rdi
callq 0x410af4
movb 0xcf(%rbx), %al
orb 0xce(%rbx), %al
jne 0x410729
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x410d02
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/controller.cc
// Function: controller::collect_data_via_write_network(unsigned char, unsigned short*)
bool controller::collect_data_via_write_network(uint8_t network, data_type* data)
{
  bool retVal = false;
  bool writeBack = false;
  data_type out_data = 0;
  for(uint16_t it=0; it < nRows_PE_Array; it++)
  {
    writeBack |= *(writeBackFromNetwork[network][it]);
    out_data |= *(dataInFromNetwork[network][it]);
  }
  if(writeBack)
  {
    *data = out_data;
    retVal = true;
  }

  return retVal;
}

// Assembly:
movq $0x60b5ac, %rax         # imm = 0x60B5AC
movzwl (%rax), %eax
testq %rax, %rax
je 0x41078d
movq 0x90(%rdi), %r8
movq 0x98(%rdi), %rcx
movzbl %sil, %esi
shll $0x3, %esi
movq (%rcx,%rsi), %rcx
movq (%r8,%rsi), %rsi
xorl %edi, %edi
xorl %r8d, %r8d
xorl %r9d, %r9d
movq (%rcx,%rdi,8), %r10
andb $0x1, %r9b
orb (%r10), %r9b
movq (%rsi,%rdi,8), %r10
orw (%r10), %r8w
incq %rdi
cmpq %rdi, %rax
jne 0x410766
testb %r9b, %r9b
je 0x41078d
movw %r8w, (%rdx)
movb $0x1, %al
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/MPSLab-ASU[P]DiRAC/./src/controller.cc
// Function: controller::inc_RF_pass()
void controller::inc_RF_pass()
{
  current_RF_pass += 1;
  PE_prefetch_RF_incomplete = true;
  PE_writeback_RF_incomplete = true;
  counter_RF_pass_prefetch = 0;
  counter_RF_pass_writeback = 0;
  cnt_bus_trigger = 0;

  for(uint8_t i=0; i < inNetworks; i++)
  {
    configNetwork[i] = 0;
    forwardDataToNetwork[i] = 0;
  }
}

// Assembly:
movq $0x60b738, %rax         # imm = 0x60B738
incw (%rax)
movw $0x101, 0xce(%rdi)      # imm = 0x101
xorl %eax, %eax
movl %eax, 0xd0(%rdi)
movl %eax, 0xf8(%rdi)
movq $0x609151, %rax         # imm = 0x609151
cmpb $0x0, (%rax)
je 0x410d4f
movq 0x58(%rdi), %rcx
movq 0x60(%rdi), %rdx
xorl %esi, %esi
xorl %edi, %edi
movb %sil, (%rcx,%rdi)
movb %sil, (%rdx,%rdi)
incq %rdi
movzbl (%rax), %r8d
cmpq %r8, %rdi
jb 0x410d3b
retq