// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]optimal-seed-solver/hobbesSolver.cc
// Function: HobbesSolver::init(int, int, int)
void HobbesSolver::init(int readLength, int seedNum, int seedLength) {
	//Initialize the matrix
	if  (invertedList != NULL) {
		delete [] invertedList;
		invertedList = NULL;
	}
	if  (defaultInvertedList != NULL) {
		delete [] defaultInvertedList;
		defaultInvertedList = NULL;
	}
		if  (dynamicMatrix != NULL) {
		delete [] dynamicMatrix;
		dynamicMatrix = NULL;
	}
	if  (defaultDynamicMatrix != NULL) {
		delete [] defaultDynamicMatrix;
		defaultDynamicMatrix = NULL;
	}

	this->readLength = readLength;
	this->seedNum = seedNum;
	this->seedLength = seedLength;
	dynamicMatrixWidth = readLength + 1 - seedNum * seedLength;

	invertedList = new int [readLength - seedLength + 1];
	defaultInvertedList = new int [readLength - seedLength + 1];

	dynamicMatrix = new int* [seedNum + 1];
	dynamicMatrix[0] = new int [dynamicMatrixWidth * (seedNum + 1)];
	defaultDynamicMatrix = new int [dynamicMatrixWidth * (seedNum + 1)];

	for (int i = 1; i <= seedNum; i++)
		dynamicMatrix[i] = dynamicMatrix[i-1] + dynamicMatrixWidth;

	for (int i = 0; i < readLength - seedLength + 1; i++)
		defaultInvertedList[i] = 0;
	
	for (int i = 0; i < dynamicMatrixWidth * (seedNum + 1); i++)
		defaultDynamicMatrix[i] = 0;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r15d
movl %edx, %r12d
movl %esi, %r14d
movq %rdi, %rbx
movq 0x358(%rdi), %rdi
testq %rdi, %rdi
je 0x4237
callq 0x32e0
andq $0x0, 0x358(%rbx)
movq 0x378(%rbx), %rdi
testq %rdi, %rdi
je 0x4250
callq 0x32e0
andq $0x0, 0x378(%rbx)
movq 0x360(%rbx), %rdi
testq %rdi, %rdi
je 0x4269
callq 0x32e0
andq $0x0, 0x360(%rbx)
movq 0x380(%rbx), %rdi
testq %rdi, %rdi
je 0x4282
callq 0x32e0
andq $0x0, 0x380(%rbx)
movl %r14d, 0x368(%rbx)
movl %r12d, 0x36c(%rbx)
movl %r15d, 0x370(%rbx)
movl %r15d, %eax
imull %r12d, %eax
negl %eax
addl %r14d, %eax
incl %eax
movl %eax, 0xc(%rsp)
movl %eax, 0x388(%rbx)
subl %r15d, %r14d
leal 0x1(%r14), %r15d
shlq $0x2, %r15
movq %r14, 0x10(%rsp)
cmpl $-0x1, %r14d
pushq $-0x1
popq %rax
cmovlq %rax, %r15
movq %rax, %r14
movq %r15, %rdi
callq 0x3030
movq %rax, 0x358(%rbx)
movq %r15, %rdi
callq 0x3030
movq %rax, 0x378(%rbx)
movslq %r12d, %rbp
leaq 0x1(%rbp), %r13
movl %r13d, %edi
shlq $0x3, %rdi
cmpl $-0x1, %ebp
cmovlq %r14, %rdi
callq 0x3030
movq %rax, %r15
movq %rax, 0x360(%rbx)
movl 0xc(%rsp), %r14d
movl %r14d, %eax
imull %r13d, %eax
leaq (,%rax,4), %r12
testl %eax, %eax
pushq $-0x1
popq %rax
cmovsq %rax, %r12
movq %r12, %rdi
callq 0x3030
movq %rax, (%r15)
movq %r12, %rdi
callq 0x3030
movq %rax, 0x380(%rbx)
movslq %r14d, %rax
xorl %ecx, %ecx
testl %ebp, %ebp
cmovlel %ecx, %ebp
shlq $0x2, %rax
cmpq %rcx, %rbp
je 0x4371
movq 0x360(%rbx), %rdx
movq (%rdx,%rcx,8), %rsi
addq %rax, %rsi
movq %rsi, 0x8(%rdx,%rcx,8)
incq %rcx
jmp 0x4354
movq 0x378(%rbx), %rax
movslq 0x10(%rsp), %rcx
xorl %edx, %edx
cmpq %rcx, %rdx
jg 0x438d
andl $0x0, (%rax,%rdx,4)
incq %rdx
jmp 0x437f
movq 0x380(%rbx), %rax
xorl %ecx, %ecx
movslq 0x388(%rbx), %rdx
imulq %r13, %rdx
cmpq %rdx, %rcx
jge 0x43af
andl $0x0, (%rax,%rcx,4)
incq %rcx
jmp 0x4396
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq