LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/FitBitSlicedAB.cpp
// Function: FitBitSlicedAB::copy(FIT_BIT_SLOT, FIT_BIT_SLOT)
void FitBitSlicedAB::copy(enum FIT_BIT_SLOT sourse_fbs, enum FIT_BIT_SLOT target_fbs) {
    NUMBER *soursePI = NULL;
    NUMBER ***sourseA = NULL;
    NUMBER ***sourseB = NULL;
    get(sourse_fbs, soursePI, sourseA, sourseB);
    NUMBER *targetPI = NULL;
    NUMBER ***targetA = NULL;
    NUMBER ***targetB = NULL;
    get(target_fbs, targetPI, targetA, targetB);
    
    copy(soursePI, sourseA, sourseB, targetPI, targetA, targetB);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebp
movq %rdi, %rbx
xorl %r12d, %r12d
leaq 0x18(%rsp), %rdx
movq %r12, (%rdx)
leaq 0x10(%rsp), %rcx
movq %r12, (%rcx)
leaq 0x8(%rsp), %r8
movq %r12, (%r8)
callq 0xd47c
leaq 0x30(%rsp), %r13
movq %r12, (%r13)
leaq 0x28(%rsp), %r14
movq %r12, (%r14)
leaq 0x20(%rsp), %r15
movq %r12, (%r15)
movq %rbx, %rdi
movl %ebp, %esi
movq %r13, %rdx
movq %r14, %rcx
movq %r15, %r8
callq 0xd47c
movq %r15, (%rsp)
movq %rbx, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r13, %r8
movq %r14, %r9
callq 0xd158
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/FitBitSlicedAB.cpp
// Function: FitBitSlicedAB::doLog10ScaleGentle(FIT_BIT_SLOT)
void FitBitSlicedAB::doLog10ScaleGentle(enum FIT_BIT_SLOT fbs) {
    // fbs - gradient or direction
    NUMBER *a_PI = NULL;
    NUMBER ***a_A = NULL;
    NUMBER ***a_B = NULL;
    get(fbs, a_PI, a_A, a_B);
	if(this->pi != NULL) doLog10Scale1DGentle(a_PI, this->pi, this->nS);
    if(this->A  != NULL)
        for(NPAR z=0; z<this->nZ; z++)
            doLog10Scale2DGentle(a_A[z],  this->A[z], this->nS, this->nS);
//        doLog10Scale3DGentle(a_A,  this->A,  this->nZ, this->nS, this->nS);
	if(this->B  != NULL)
        for(NPAR z=0; z<this->nZ; z++)
            doLog10Scale2DGentle(a_B[z],  this->B[z], this->nS, this->nO);
//        doLog10Scale3DGentle(a_B,  this->B,  this->nZ, this->nS, this->nO);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
xorl %eax, %eax
leaq 0x18(%rsp), %rdx
movq %rax, (%rdx)
leaq 0x10(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x8(%rsp), %r8
movq %rax, (%r8)
callq 0xd47c
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0xd7e8
movq 0x18(%rsp), %rdi
movsbl 0x1(%rbx), %edx
callq 0x93b6
cmpq $0x0, 0x18(%rbx)
je 0xd821
cmpb $0x0, 0x2(%rbx)
jle 0xd821
movq 0x10(%rsp), %r14
xorl %r15d, %r15d
movq (%r14,%r15,8), %rdi
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %rsi
movsbl 0x1(%rbx), %ecx
movl %ecx, %edx
callq 0x9662
incq %r15
movsbq 0x2(%rbx), %rax
cmpq %rax, %r15
jl 0xd7fd
cmpq $0x0, 0x20(%rbx)
je 0xd85b
cmpb $0x0, 0x2(%rbx)
jle 0xd85b
movq 0x8(%rsp), %r14
xorl %r15d, %r15d
movq (%r14,%r15,8), %rdi
movq 0x20(%rbx), %rax
movq (%rax,%r15,8), %rsi
movsbl 0x1(%rbx), %edx
movsbl (%rbx), %ecx
callq 0x9662
incq %r15
movsbq 0x2(%rbx), %rax
cmpq %rax, %r15
jl 0xd836
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/InputUtil.cpp
// Function: InputUtil::writeString(_IO_FILE*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void InputUtil::writeString(FILE *f, string str) {
    // Create char pointer from string.
    char* text = const_cast<char*>(str.c_str());
    // Find the length of the string.
    NDAT size = (NDAT)str.size();
    // Write the string's size to the file.
    fwrite(&size, sizeof(NDAT), 1, f);
    // Followed by the string itself.
    fwrite(text, 1, (size_t)size, f);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq (%rsi), %r14
movl 0x8(%rsi), %eax
leaq 0xc(%rsp), %r15
movl %eax, (%r15)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x4480
movslq (%r15), %rdx
movl $0x1, %esi
movq %r14, %rdi
movq %rbx, %rcx
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x4480
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/InputUtil.cpp
// Function: InputUtil::readString[abi:cxx11](_IO_FILE*)
string InputUtil::readString(FILE *f) {
    // Create new string object to store the retrieved text and to return to the calling function.
    string str;
    // UInt for storing the string's size.
    NDAT size;
    // Read the size of the string from the file and store it in size.
    fread(&size, sizeof(NDAT), 1, f);
    // Create a char pointer for temporary storage.
    char* text = new char[size];
    // Read [size] number of characters from the string and store them in text.
    fread(text, 1, (size_t)size, f);
    // Store the contents of text in str.
    str = text;
    // Resize str to match the size else we get extra cruft (line endings methinks).
    str.resize((size_t)size);
    // Finally, return the string to the calling function.
    delete[] text;
    return str;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x10(%rdi), %r13
movq %r13, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
leaq 0xc(%rsp), %r14
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %r12, %rcx
callq 0x4360
movslq (%r14), %r15
movq %r15, %rdi
callq 0x4030
movq %rax, %r14
movl $0x1, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %r12, %rcx
callq 0x4360
movq 0x8(%rbx), %r12
movq %r14, %rdi
callq 0x4100
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rax, %r8
callq 0x4390
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x40c0
movq %r14, %rdi
callq 0x42f0
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r13, %rdi
je 0xdbe5
movq (%r13), %rsi
incq %rsi
callq 0x4220
movq %r14, %rdi
callq 0x4430
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/./StripedArray.h
// Function: StripedArray<signed char>::add(signed char)
void StripedArray<T>::add(T value) {
	if(this->size == (NDAT_MAX-1)) {
		fprintf(stderr, "Error! Maximum array size reached.\n");
		return;
	}
	
	// add stripe if necessary
	if( this->nstripes==0 || this->size_last_stripe==this->stripe_size)
		this->addStripe();
	// place data
	this->stripes[this->nstripes-1][this->size_last_stripe++] = value;
	this->size++;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpl $0x7ffffffe, (%rdi)     # imm = 0x7FFFFFFE
je 0xfd58
movl %esi, %ebp
movq %rdi, %rbx
cmpl $0x0, 0x8(%rdi)
je 0xfd2c
movl 0xc(%rbx), %eax
cmpl 0x4(%rbx), %eax
jne 0xfd34
movq %rbx, %rdi
callq 0x100da
movq 0x10(%rbx), %rax
movslq 0x8(%rbx), %rcx
movq -0x8(%rax,%rcx,8), %rax
movslq 0xc(%rbx), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0xc(%rbx)
movb %bpl, (%rax,%rcx)
incl (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
callq 0x4967
jmp 0xfd51
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/./StripedArray.h
// Function: StripedArray<int>::toArray()
T* StripedArray<T>::toArray() {
    T *result = (T*)malloc( (size_t)this->size*sizeof(T));
    for(NDAT i=0; i<this->nstripes; i++) {
        T* dest = &result[ i*this->stripe_size ];
        size_t sz = sizeof(T)*( (i<(this->nstripes-1))?this->stripe_size:this->size_last_stripe );
        memcpy( dest, this->stripes[i], sz );  
    }
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movslq (%rdi), %rdi
shlq $0x2, %rdi
callq 0x4300
movq %rax, (%rsp)
movslq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
jle 0xfeed
movslq 0x4(%r14), %r15
movq 0x8(%rsp), %rax
decq %rax
movq %rax, 0x10(%rsp)
movl 0xc(%r14), %ebp
movq 0x10(%r14), %rbx
movq %r15, %r12
shlq $0x2, %r12
xorl %r13d, %r13d
movq (%rsp), %r14
cmpq 0x10(%rsp), %r13
movl %ebp, %eax
cmovll %r15d, %eax
movslq %eax, %rdx
shlq $0x2, %rdx
movq (%rbx,%r13,8), %rsi
movq %r14, %rdi
callq 0x41c0
incq %r13
addq %r12, %r14
cmpq %r13, 0x8(%rsp)
jne 0xfec2
movq (%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/./StripedArray.h
// Function: StripedArray<signed char>::~StripedArray()
StripedArray<T>::~StripedArray() {
	for(NDAT i=0; i<this->nstripes;i++) {
//        if(this->complex)
//            for(NDAT j=0; j<( (i<(this->nstripes-1))?this->stripe_size:this->size_last_stripe );j++)
//                free(  (void *)(this->stripes[i][j]) );
		free(this->stripes[i]);
    }
	free(this->stripes);
//	for(NDAT i=0; i<this->nstripes;i++)
//		delete [] this->stripes[i];
//	delete [] this->stripes;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x8(%rdi)
jle 0xfe5b
xorl %r14d, %r14d
movq 0x10(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x42a0
incq %r14
movslq 0x8(%rbx), %rax
cmpq %rax, %r14
jl 0xfe42
movq 0x10(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x42a0
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/./StripedArray.h
// Function: StripedArray<signed char>::StripedArray(_IO_FILE*, int)
StripedArray<T>::StripedArray(FILE *f, NDAT N) {
	stripe_size = 20000;
//    complex = false;
	size = N;
	nstripes = (NDAT)ceil((double)N/stripe_size);
	size_last_stripe = (NDAT)fmod(N, stripe_size);
	stripes = (T **) calloc((size_t)nstripes, sizeof(T*));
    NDAT num;
    NDAT nread;
    for(NDAT i=0; i<nstripes; i++) {
        num = (i<(nstripes-1)?stripe_size:size_last_stripe);
        stripes[i] = (T*)calloc((size_t)num, sizeof(T)); // alloc data
        nread = (NDAT)fread (stripes[i], sizeof(T), (size_t)num, f);
        if(nread != num) {
            fprintf(stderr,"Error reading data from file\n");
            return;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x4e20, 0x4(%rdi)      # imm = 0x4E20
cvtsi2sd %edx, %xmm0
movsd %xmm0, (%rsp)
movl %edx, (%rdi)
divsd 0x24f8e(%rip), %xmm0    # 0x34ef0
callq 0x4090
cvttsd2si %xmm0, %eax
movl %eax, 0x8(%r14)
movsd (%rsp), %xmm0
movsd 0x24f74(%rip), %xmm1    # 0x34ef0
callq 0x4310
cvttsd2si %xmm0, %eax
movl %eax, 0xc(%r14)
movslq 0x8(%r14), %r15
movl $0x8, %esi
movq %r15, %rdi
callq 0x4130
movq %rax, 0x10(%r14)
testq %r15, %r15
jle 0xfff7
xorl %r12d, %r12d
decl %r15d
movslq %r15d, %rax
xorl %ecx, %ecx
cmpq %rax, %r12
setge %cl
movslq 0x4(%r14,%rcx,8), %r15
movl $0x1, %esi
movq %r15, %rdi
callq 0x4130
movq 0x10(%r14), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x10(%r14), %rax
movq (%rax,%r12,8), %rdi
movl $0x1, %esi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x4360
cmpl %eax, %r15d
jne 0x10003
incq %r12
movslq 0x8(%r14), %r15
cmpq %r15, %r12
jl 0xffa6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x49bb
jmp 0xfff7
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/./StripedArray.h
// Function: StripedArray<signed char>::addStripe()
void StripedArray<T>::addStripe() {
	if(this->size_last_stripe<this->stripe_size && this->nstripes>0) {
		fprintf(stderr, "Exception! You can only add stripes when none exits or previous is full.\n");
		return;
	}
	
	this->stripes = (T **) realloc(this->stripes,(size_t)(++this->nstripes)*sizeof(T*)); // add pointer
//	T** new_stripes = Calloc(T*, (this->nstripes));
//	memcpy(new_stripes, this->stripes, sizeof(T*)*this->nstripes );
//	free(this->stripes);
//	this->stripes = Malloc(T*,this->nstripes+1);
//	memcpy(this->stripes, new_stripes, sizeof(T*)*this->nstripes );
//	this->nstripes++;
//	free(new_stripes);
	
//	this->stripes[this->nstripes-1] = Calloc(T, (size_t)this->stripe_size); // alloc data
	this->stripes[this->nstripes-1] = (T*)calloc((size_t)this->stripe_size, sizeof(T)); // alloc data
	this->size_last_stripe = 0; // reset counter
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x8(%rdi), %eax
movl 0xc(%rdi), %ecx
cmpl 0x4(%rdi), %ecx
setl %cl
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
je 0x10140
movq %rdi, %rbx
cltq
movq 0x10(%rdi), %rdi
leaq 0x1(%rax), %rcx
movl %ecx, 0x8(%rbx)
leaq 0x8(,%rax,8), %rsi
callq 0x43f0
movq %rax, %r14
movq %rax, 0x10(%rbx)
movslq 0x4(%rbx), %rdi
movl $0x1, %esi
callq 0x4130
movslq 0x8(%rbx), %rcx
movq %rax, -0x8(%r14,%rcx,8)
movl $0x0, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x49f3
jmp 0x10138
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/PULogistic.cpp
// Function: PULogistic::unite(double*, int, double*, int)
NUMBER PULogistic::unite(NUMBER* standard, NCAT nstandard, NUMBER* pooled, NCAT npooled) {
	NUMBER num = 1;
	NUMBER den = 1;
	NUMBER safe = 0;
	if(standard != NULL && nstandard > 0) {
		for(NCAT i=0; i<=nstandard; i++) {
			safe = safe01num(standard[i]);
			num *= 1 - safe;
			den *=     safe;
		}
	}
	if(pooled != NULL && npooled > 0) {
		for(NCAT i=0; i<=nstandard; i++) {
			safe = safe01num(pooled[i]);
			num *= 1 - safe;
			den *=     safe;
		}
	}
	return 1/( 1 + num/safe0num(den) );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebp
movq %rcx, %rbx
movl %edx, %r14d
testq %rsi, %rsi
sete %al
testl %edx, %edx
setle %cl
orb %al, %cl
jne 0x10691
movq %rsi, %r15
leal 0x1(%r14), %r12d
movsd 0x242bf(%rip), %xmm1    # 0x348f0
xorl %r13d, %r13d
movapd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
movsd (%r15,%r13,8), %xmm0
callq 0x8d62
movsd 0x24299(%rip), %xmm1    # 0x348f0
subsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, 0x8(%rsp)
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
mulsd %xmm0, %xmm2
movsd %xmm2, 0x10(%rsp)
movsd 0x10(%rsp), %xmm0
incq %r13
cmpq %r13, %r12
jne 0x10638
jmp 0x1069d
movsd 0x24257(%rip), %xmm1    # 0x348f0
movapd %xmm1, %xmm0
testq %rbx, %rbx
sete %al
testl %ebp, %ebp
setle %cl
testl %r14d, %r14d
sets %dl
orb %cl, %dl
orb %al, %dl
movsd %xmm1, 0x8(%rsp)
jne 0x1070b
incl %r14d
xorl %r15d, %r15d
movsd %xmm0, 0x10(%rsp)
movsd (%rbx,%r15,8), %xmm0
callq 0x8d62
movsd 0x24217(%rip), %xmm1    # 0x348f0
subsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, 0x8(%rsp)
movsd 0x10(%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x10(%rsp), %xmm0
incq %r15
cmpq %r15, %r14
jne 0x106c0
callq 0x8d88
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x241ce(%rip), %xmm0    # 0x348f0
addsd %xmm0, %xmm1
divsd %xmm1, %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/PULogistic.cpp
// Function: PULogistic::derivativePair(double, double, signed char)
NUMBER PULogistic::derivativePair(NUMBER standard, NUMBER pooled, NPAR which) {
	NUMBER united = pair(standard, pooled);
	// which 0-standard, 1-pooled
	NUMBER deriv_param = 0;
	if(which==0) {
		NUMBER safe_standard = safe01num(standard);
		deriv_param = 1 / ( safe_standard * (1 - safe_standard) );
	} else if(which==1) {
		NUMBER safe_pooled   = safe01num(pooled);
		deriv_param = 1 / (   safe_pooled * (1 -   safe_pooled) );
	}
	return united * (1-united) * deriv_param;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movq (%rdi), %rax
movsd %xmm0, (%rsp)
movsd %xmm1, 0x8(%rsp)
callq *(%rax)
movapd %xmm0, %xmm2
testl %ebx, %ebx
je 0x1076d
xorpd %xmm1, %xmm1
cmpl $0x1, %ebx
jne 0x10799
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd (%rsp), %xmm0
movsd %xmm2, (%rsp)
callq 0x8d62
movsd 0x2416c(%rip), %xmm1    # 0x348f0
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
mulsd %xmm0, %xmm2
divsd %xmm2, %xmm1
movsd (%rsp), %xmm2
movsd 0x2414f(%rip), %xmm0    # 0x348f0
subsd %xmm2, %xmm0
mulsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/PULogistic.cpp
// Function: PULogistic::derivativeUnite(double*, int, double*, int, signed char, int)
NUMBER PULogistic::derivativeUnite(NUMBER* standard, NCAT nstandard, NUMBER* pooled, NCAT npooled, NPAR which, NCAT index) {
	NUMBER united = unite(standard, nstandard, pooled, npooled);
	// which 0-standard, 1-pooled
	NUMBER deriv_param = 0;
	if(which==0) {
		NUMBER safe_standard = safe01num(standard[index]);
		deriv_param = 1 / ( safe_standard * (1 - safe_standard) );
	} else if(which==1) {
		NUMBER safe_pooled   = safe01num(pooled[index]);
		deriv_param = 1 / (   safe_pooled * (1 -   safe_pooled) );
	}
	return united * (1-united) * deriv_param;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %r9d, %ebp
movq %rcx, %rbx
movq %rsi, %r14
movq (%rdi), %rax
callq *0x8(%rax)
movapd %xmm0, %xmm2
testl %ebp, %ebp
je 0x107df
xorpd %xmm1, %xmm1
cmpl $0x1, %ebp
jne 0x10813
movq %rbx, %r14
movslq 0x30(%rsp), %rax
movsd (%r14,%rax,8), %xmm0
movsd %xmm2, 0x8(%rsp)
callq 0x8d62
movsd 0x240f3(%rip), %xmm1    # 0x348f0
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
mulsd %xmm0, %xmm2
divsd %xmm2, %xmm1
movsd 0x8(%rsp), %xmm2
movsd 0x240d5(%rip), %xmm0    # 0x348f0
subsd %xmm2, %xmm0
mulsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/PULogistic.cpp
// Function: PULogistic::derivativeUnite(double, double, double, signed char)
NUMBER PULogistic::derivativeUnite(NUMBER united, NUMBER standard, NUMBER pooled, NPAR which) {
	// which 0-standard, 1-pooled
	NUMBER deriv_param = 0;
	if(which==0) {
		NUMBER safe_standard = safe01num(standard);
		deriv_param = 1 / ( safe_standard * (1 - safe_standard) );
	} else if(which==1) {
		NUMBER safe_pooled   = safe01num(pooled);
		deriv_param = 1 / (   safe_pooled * (1 -   safe_pooled) );
	}
	return united * (1-united) * deriv_param;
}

// Assembly:
pushq %rax
movapd %xmm0, %xmm3
testl %esi, %esi
je 0x10846
xorpd %xmm1, %xmm1
cmpl $0x1, %esi
jne 0x10871
movapd %xmm2, %xmm1
movapd %xmm1, %xmm0
movsd %xmm3, (%rsp)
callq 0x8d62
movsd (%rsp), %xmm3
movsd 0x2408f(%rip), %xmm1    # 0x348f0
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
mulsd %xmm0, %xmm2
divsd %xmm2, %xmm1
movsd 0x24077(%rip), %xmm0    # 0x348f0
subsd %xmm3, %xmm0
mulsd %xmm3, %xmm0
mulsd %xmm1, %xmm0
popq %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/PUCorbettianAdditive.cpp
// Function: PUCorbettianAdditive::sumOdds(double*, int, double*, int)
NUMBER PUCorbettianAdditive::sumOdds(NUMBER* standard, NCAT nstandard, NUMBER* pooled, NCAT npooled) {
	NUMBER sum_odds = 0;
	if(standard != NULL && nstandard > 0) {
		for(NCAT i=0; i<=nstandard; i++) {
			sum_odds += standard[i] / safe0num(1-standard[i]);
		}
	}
	if(pooled != NULL && npooled > 0) {
		for(NCAT i=0; i<=nstandard; i++) {
			sum_odds += pooled[i];
		}
	}
	return sum_odds;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebp
movq %rcx, %rbx
movl %edx, %r14d
testq %rsi, %rsi
sete %al
testl %edx, %edx
setle %cl
xorpd %xmm0, %xmm0
orb %al, %cl
jne 0x10949
movq %rsi, %r15
leal 0x1(%r14), %r12d
xorl %r13d, %r13d
movsd %xmm0, 0x10(%rsp)
movsd (%r15,%r13,8), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x23fcc(%rip), %xmm0    # 0x348f0
subsd %xmm1, %xmm0
callq 0x8d88
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
incq %r13
cmpq %r13, %r12
jne 0x1090a
testq %rbx, %rbx
sete %al
testl %ebp, %ebp
setle %cl
testl %r14d, %r14d
sets %dl
orb %cl, %dl
orb %al, %dl
jne 0x10972
incl %r14d
xorl %eax, %eax
addsd (%rbx,%rax,8), %xmm0
incq %rax
cmpq %rax, %r14
jne 0x10965
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/PUCorbettianAdditive.cpp
// Function: PUCorbettianAdditive::derivativeUnite(double*, int, double*, int, signed char, int)
NUMBER PUCorbettianAdditive::derivativeUnite(NUMBER* standard, NCAT nstandard, NUMBER* pooled, NCAT npooled, NPAR which, NCAT index) {
	NUMBER sum_odds = sumOdds(standard, nstandard, pooled, npooled);
	// which 0-standard
	// \frac{1}{ (1+O_{ x_{ i },g_{ j } }^{ add } )^2 } \frac { 1 }{ (1-x_{ i })^2 }
	// which 1-pooled
	// \frac{1}{ (1+O_{ x_{ i },g_{ j } }^{ add } )2 }
	return 1 / ( pow(1+sum_odds,2) ) * ((which==0) ? ( 1/(pow( safe0num(1-standard[index]) ,2)) ) : 1 );
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %r9d, %ebp
movq %rsi, %rbx
callq 0x108d6
movapd %xmm0, %xmm1
movsd 0x23ec8(%rip), %xmm0    # 0x348f0
movapd %xmm0, %xmm2
testb %bpl, %bpl
jne 0x10a6a
movslq 0x20(%rsp), %rax
movsd 0x23eb2(%rip), %xmm0    # 0x348f0
subsd (%rbx,%rax,8), %xmm0
movsd %xmm1, (%rsp)
callq 0x8d88
movsd 0x23e9b(%rip), %xmm2    # 0x348f0
movsd (%rsp), %xmm1
mulsd %xmm0, %xmm0
divsd %xmm0, %xmm2
movsd 0x23e86(%rip), %xmm0    # 0x348f0
addsd %xmm0, %xmm1
mulsd %xmm1, %xmm1
divsd %xmm1, %xmm0
mulsd %xmm2, %xmm0
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::HMMProblem(param*)
HMMProblem::HMMProblem(struct param *param) {
    NPAR i;
    switch (param->structure) {
        case STRUCTURE_SKILL: // Expectation Maximization (Baum-Welch)
            for(i=0; i<3; i++) this->sizes[i] = param->nK;
            this->n_params = param->nK * 4;
            break;
//        case STRUCTURE_GROUP: // Gradient Descent by group
//            for(i=0; i<3; i++) this->sizes[i] = param->nG;
//            this->n_params = param->nG * 4;
//            break;
        default:
            fprintf(stderr,"Structure specified is not supported and should have been caught earlier\n");
            break;
    }
    init(param);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x2ea5d(%rip), %rax     # 0x3f5a8
movq %rax, (%rdi)
cmpb $0x1, 0x3e(%rsi)
jne 0x10b8d
xorl %eax, %eax
movl 0x8c0(%rbx), %ecx
movl %ecx, 0xc(%r14,%rax,4)
incq %rax
cmpq $0x3, %rax
jne 0x10b56
movl 0x8c0(%rbx), %eax
shll $0x2, %eax
movl %eax, 0x8(%r14)
movq (%r14), %rax
movq 0x70(%rax), %rax
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *%rax
callq 0x4a2b
jmp 0x10b77
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::checkPIABConstraints(double*, double**, double**)
bool HMMProblem::checkPIABConstraints(NUMBER* a_PI, NUMBER** a_A, NUMBER** a_B) {
	NPAR i, j;
	// check values
	NUMBER sum_pi = 0.0;
	NUMBER sum_a_row[this->p->nS];
	NUMBER sum_b_row[this->p->nS];
	for(i=0; i<this->p->nS; i++) {
		sum_a_row[i] = 0.0;
		sum_b_row[i] = 0.0;
	}
	
	for(i=0; i<this->p->nS; i++) {
		if( a_PI[i]>1.0 || a_PI[i]<0.0)
			return false;
		sum_pi += a_PI[i];
		for(j=0; j<this->p->nS; j++) {
			if( a_A[i][j]>1.0 || a_A[i][j]<0.0)
				return false;
			sum_a_row[i] += a_A[i][j];
		}// all states 2
		for(int m=0; m<this->p->nO; m++) {
			if( a_B[i][m]>1.0 || a_B[i][m]<0.0)
				return false;
			sum_b_row[i] += a_B[i][m];
		}// all observations
	}// all states
	if(sum_pi!=1.0)
		return false;
	for(i=0; i<this->p->nS; i++)
		if( sum_a_row[i]!=1.0 || sum_b_row[i]!=1.0)
			return false;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r9
movq %rsi, %r13
movq 0x88(%rdi), %r12
movzbl 0x8b8(%r12), %r15d
leal 0xf(,%r15,8), %eax
andl $-0x10, %eax
movq %rsp, %rbx
subq %rax, %rbx
movq %rbx, %rsp
movq %rsp, %r14
subq %rax, %r14
movq %r14, %rsp
testb %r15b, %r15b
jle 0x111f9
leal (,%r15,8), %edx
movq %rbx, %rdi
xorl %esi, %esi
movq %rcx, -0x38(%rbp)
movq %r9, -0x30(%rbp)
callq 0x4120
leal (,%r15,8), %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x4120
movq -0x30(%rbp), %r9
movq -0x38(%rbp), %rcx
testb %r15b, %r15b
jle 0x112b6
xorpd %xmm1, %xmm1
xorl %r8d, %r8d
movsd 0x236df(%rip), %xmm0    # 0x348f0
xorpd %xmm2, %xmm2
movsd (%r13,%r8,8), %xmm3
xorl %eax, %eax
ucomisd %xmm0, %xmm3
ja 0x112b8
ucomisd %xmm3, %xmm1
ja 0x112b8
addsd %xmm3, %xmm2
movq (%r9,%r8,8), %rdx
xorl %esi, %esi
movsd (%rdx,%rsi,8), %xmm3
xorl %eax, %eax
ucomisd %xmm0, %xmm3
ja 0x112b8
ucomisd %xmm3, %xmm1
ja 0x112b8
addsd (%rbx,%r8,8), %xmm3
movsd %xmm3, (%rbx,%r8,8)
incq %rsi
cmpq %rsi, %r15
jne 0x1123c
movsbq 0x8b9(%r12), %rdx
testq %rdx, %rdx
jle 0x1129e
movq (%rcx,%r8,8), %rsi
xorl %edi, %edi
movsd (%rsi,%rdi,8), %xmm3
xorl %eax, %eax
ucomisd %xmm0, %xmm3
ja 0x112b8
ucomisd %xmm3, %xmm1
ja 0x112b8
addsd (%r14,%r8,8), %xmm3
movsd %xmm3, (%r14,%r8,8)
incq %rdi
cmpq %rdi, %rdx
jne 0x11277
incq %r8
cmpq %r15, %r8
jne 0x11215
ucomisd 0x2363e(%rip), %xmm2    # 0x348f0
jne 0x112b6
jnp 0x112c7
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ecx, %ecx
movsd (%rbx,%rcx,8), %xmm1
ucomisd %xmm0, %xmm1
jne 0x112b6
jp 0x112b6
movsd (%r14,%rcx,8), %xmm1
ucomisd %xmm0, %xmm1
jne 0x112b6
jp 0x112b6
incq %rcx
movb $0x1, %al
cmpq %rcx, %r15
jne 0x112c9
jmp 0x112b8
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::readModel(char const*, bool)
void HMMProblem::readModel(const char *filename, bool overwrite) {
	FILE *fid = fopen(filename,"r");
	if(fid == NULL)
	{
		fprintf(stderr,"Can't read model file %s\n",filename);
		exit(1);
	}
	int max_line_length = 1024;
	char *line = Malloc(char,(size_t)max_line_length);
	NDAT line_no = 0;
    struct param initparam;
    set_param_defaults(&initparam);
    
    //
    // read solver info
    //
    if(overwrite)
        readSolverInfo(fid, this->p, &line_no);
    else
        readSolverInfo(fid, &initparam, &line_no);
    //
    // read model
    //
    readModelBody(fid, &initparam, &line_no, overwrite);
		
	fclose(fid);
	free(line);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x9b8, %rsp            # imm = 0x9B8
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r14
leaq 0x22d38(%rip), %rsi     # 0x34044
movq %r15, %rdi
callq 0x4290
testq %rax, %rax
je 0x1137e
movq %rax, %rbx
movl $0x0, 0xc(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x9c08
testb %bpl, %bpl
je 0x1133c
movq 0x88(%r14), %rsi
jmp 0x11341
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
callq 0xa1e6
movq (%r14), %rax
movzbl %bpl, %r8d
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
movq %r14, %rdi
movq %rbx, %rsi
callq *0x68(%rax)
movq %rbx, %rdi
callq 0x4200
addq $0x9b8, %rsp            # imm = 0x9B8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x4a6c
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::destroy()
void HMMProblem::destroy() {
	// destroy model data
    if(this->null_obs_ratio != NULL) free(this->null_obs_ratio);
	if(this->pi != NULL) free2D<NUMBER>(this->pi, this->sizes[0]);
	if(this->A  != NULL) free3D<NUMBER>(this->A,  this->sizes[1], this->p->nS);
	if(this->B  != NULL) free3D<NUMBER>(this->B,  this->sizes[2], this->p->nS);
	if(this->lbPI!=NULL) free(this->lbPI);
	if(this->ubPI!=NULL) free(this->ubPI);
	if(this->lbA!=NULL) free2D<NUMBER>(this->lbA, this->p->nS);
	if(this->ubA!=NULL) free2D<NUMBER>(this->ubA, this->p->nS);
	if(this->lbB!=NULL) free2D<NUMBER>(this->lbB, this->p->nS);
	if(this->ubB!=NULL) free2D<NUMBER>(this->ubB, this->p->nS);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
je 0x113ca
callq 0x42a0
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x113db
movl 0xc(%rbx), %esi
callq 0xa5e0
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x113fa
movl 0x10(%rbx), %esi
movq 0x88(%rbx), %rax
movsbl 0x8b8(%rax), %edx
callq 0xca4f
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x11419
movl 0x14(%rbx), %esi
movq 0x88(%rbx), %rax
movsbl 0x8b8(%rax), %edx
callq 0xca4f
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x11427
callq 0x42a0
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x11435
callq 0x42a0
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x11451
movq 0x88(%rbx), %rax
movsbl 0x8b8(%rax), %esi
callq 0xa5e0
movq 0x70(%rbx), %rdi
testq %rdi, %rdi
je 0x1146d
movq 0x88(%rbx), %rax
movsbl 0x8b8(%rax), %esi
callq 0xa5e0
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x11489
movq 0x88(%rbx), %rax
movsbl 0x8b8(%rax), %esi
callq 0xa5e0
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x114a6
movq 0x88(%rbx), %rax
movsbl 0x8b8(%rax), %esi
popq %rbx
jmp 0xa5e0
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::getPI(int)
NUMBER* HMMProblem::getPI(NCAT x) {
	if( x > (this->sizes[0]-1) ) {
		fprintf(stderr,"While accessing PI, skill index %d exceeded last index of the data %d.\n", x, this->sizes[0]-1);
		exit(1);
	}
	return this->pi[x];
}

// Assembly:
movq %rdi, %rax
movl 0xc(%rdi), %edi
cmpl %esi, %edi
jle 0x114d8
movq 0x38(%rax), %rax
movslq %esi, %rcx
movq (%rax,%rcx,8), %rax
retq
pushq %rax
callq 0x4a90
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::getA(int)
NUMBER** HMMProblem::getA(NCAT x) {
	if( x > (this->sizes[1]-1) ) {
		fprintf(stderr,"While accessing A, skill index %d exceeded last index of the data %d.\n", x, this->sizes[1]-1);
		exit(1);
	}
	return this->A[x];
}

// Assembly:
movq %rdi, %rax
movl 0x10(%rdi), %edi
cmpl %esi, %edi
jle 0x114f4
movq 0x40(%rax), %rax
movslq %esi, %rcx
movq (%rax,%rcx,8), %rax
retq
pushq %rax
callq 0x4ab7
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::getB(int)
NUMBER** HMMProblem::getB(NCAT x) {
	if( x > (this->sizes[2]-1) ) {
		fprintf(stderr,"While accessing B, skill index %d exceeded last index of the data %d.\n", x, this->sizes[2]-1);
		exit(1);
	}
	return this->B[x];
}

// Assembly:
movq %rdi, %rax
movl 0x14(%rdi), %edi
cmpl %esi, %edi
jle 0x11510
movq 0x48(%rax), %rax
movslq %esi, %rcx
movq (%rax,%rcx,8), %rax
retq
pushq %rax
callq 0x4ade
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::getB(data*, signed char, signed char)
NUMBER HMMProblem::getB (struct data* dt, NPAR i, NPAR m) {
    // special attention for "unknonw" observations, i.e. the observation was there but we do not know what it is
    // in this case we simply return 1, effectively resulting in no change in \alpha or \beta vatiables
    if(m<0)
        return 1;
    switch(this->p->structure)
    {
        case STRUCTURE_SKILL:
            return this->B[dt->k][i][m];
            break;
//        case STRUCTURE_GROUP:
//            return this->B[dt->g][i][m];
//            break;
        default:
            fprintf(stderr,"Solver specified is not supported.\n");
            exit(1);
            break;
    }
}

// Assembly:
testb %cl, %cl
js 0x1160c
movq 0x88(%rdi), %rax
cmpb $0x1, 0x3e(%rax)
jne 0x11615
movq 0x48(%rdi), %rax
movslq 0x58(%rsi), %rsi
movq (%rax,%rsi,8), %rax
movsbq %dl, %rdx
movq (%rax,%rdx,8), %rax
movzbl %cl, %ecx
movsd (%rax,%rcx,8), %xmm0
retq
movsd 0x232dc(%rip), %xmm0    # 0x348f0
retq
pushq %rax
callq 0x4b4f
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::initAlpha(int, data**)
void HMMProblem::initAlpha(NCAT xndat, struct data** x_data) {
	NPAR nS = this->p->nS;
//    int parallel_now = this->p->parallel==2; //PAR
//    #pragma omp parallel for schedule(dynamic) if(parallel_now) //PAR
	for(NCAT x=0; x<xndat; x++) {
        NDAT t;
        NPAR i;
		if( x_data[x]->cnt!=0 ) continue; // ... and the thing has not been computed yet (e.g. from group to skill)
		// alpha
		if( x_data[x]->alpha == NULL ) {
			x_data[x]->alpha = Calloc(NUMBER*, (size_t)x_data[x]->n);
			for(t=0; t<x_data[x]->n; t++)
				x_data[x]->alpha[t] = Calloc(NUMBER, (size_t)nS);
			
		} else {
			for(t=0; t<x_data[x]->n; t++)
				for(i=0; i<nS; i++)
					x_data[x]->alpha[t][i] = 0.0;
		}
		// p_O_param
		x_data[x]->p_O_param = 0.0;
		x_data[x]->loglik = 0.0;
        // c - scaling
		if( x_data[x]->c == NULL ) {
            x_data[x]->c = Calloc(NUMBER, (size_t)x_data[x]->n);
        } else {
			for(t=0; t<x_data[x]->n; t++)
                x_data[x]->c[t] = 0.0;
        }
	} // for all groups in skill
}

// Assembly:
testl %esi, %esi
jle 0x1177c
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq 0x88(%rdi), %rax
movzbl 0x8b8(%rax), %r12d
movsbq %r12b, %rax
movq %rax, 0x8(%rsp)
movl %r12d, %eax
shll $0x3, %eax
movq %rax, 0x10(%rsp)
movl %esi, %r14d
xorl %ebp, %ebp
movq %r14, (%rsp)
movq (%rbx,%rbp,8), %r15
cmpl $0x0, 0x4(%r15)
je 0x116a9
incq %rbp
cmpq %r14, %rbp
jne 0x11691
jmp 0x1176e
movq 0x28(%r15), %r14
movl (%r15), %r13d
testq %r14, %r14
je 0x116dc
testl %r13d, %r13d
jle 0x11720
xorl %r15d, %r15d
testb %r12b, %r12b
jle 0x116d2
movq (%r14,%r15,8), %rdi
xorl %esi, %esi
movq 0x10(%rsp), %rdx
callq 0x4120
incq %r15
cmpq %r15, %r13
jne 0x116bd
jmp 0x11720
movslq %r13d, %rdi
movl $0x8, %esi
callq 0x4130
movq %rax, 0x28(%r15)
movq (%rbx,%rbp,8), %r14
cmpl $0x0, (%r14)
jle 0x11720
xorl %r13d, %r13d
movl $0x8, %esi
movq 0x8(%rsp), %rdi
callq 0x4130
movq 0x28(%r14), %rcx
movq %rax, (%rcx,%r13,8)
incq %r13
movq (%rbx,%rbp,8), %r14
movslq (%r14), %rax
cmpq %rax, %r13
jl 0x116fa
movq (%rbx,%rbp,8), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%r14)
movq 0x20(%r14), %rdi
movl (%r14), %edx
testq %rdi, %rdi
je 0x11754
testl %edx, %edx
movq (%rsp), %r14
jle 0x1169c
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x4120
jmp 0x1169c
movslq %edx, %rdi
movl $0x8, %esi
callq 0x4130
movq %rax, 0x20(%r14)
movq (%rsp), %r14
jmp 0x1169c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::initBeta(int, data**)
void HMMProblem::initBeta(NCAT xndat, struct data** x_data) {
	NPAR nS = this->p->nS;
//    int parallel_now = this->p->parallel==2; //PAR
//    #pragma omp parallel for schedule(dynamic) if(parallel_now) //PAR
	for(NCAT x=0; x<xndat; x++) {
        NDAT t;
        NPAR i;
		if( x_data[x]->cnt!=0 ) continue; // ... and the thing has not been computed yet (e.g. from group to skill)
		// beta
		if( x_data[x]->beta == NULL ) {
			x_data[x]->beta = Calloc(NUMBER*, (size_t)x_data[x]->n);
			for(t=0; t<x_data[x]->n; t++)
				x_data[x]->beta[t] = Calloc(NUMBER, (size_t)nS);
			
		} else {
			for(t=0; t<x_data[x]->n; t++)
				for(i=0; i<nS; i++)
					x_data[x]->beta[t][i] = 0.0;
		}
	} // for all groups in skill
}

// Assembly:
testl %esi, %esi
jle 0x11a84
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq 0x88(%rdi), %rax
movzbl 0x8b8(%rax), %r12d
movsbq %r12b, %rax
movq %rax, 0x8(%rsp)
movl %r12d, %eax
shll $0x3, %eax
movq %rax, 0x10(%rsp)
movl %esi, %eax
movq %rax, (%rsp)
xorl %ebp, %ebp
movq (%rbx,%rbp,8), %r15
cmpl $0x0, 0x4(%r15)
je 0x119fa
incq %rbp
cmpq (%rsp), %rbp
jne 0x119e4
jmp 0x11a76
movq 0x30(%r15), %r14
movl (%r15), %r13d
testq %r14, %r14
je 0x11a2d
testl %r13d, %r13d
jle 0x119ef
xorl %r15d, %r15d
testb %r12b, %r12b
jle 0x11a23
movq (%r14,%r15,8), %rdi
xorl %esi, %esi
movq 0x10(%rsp), %rdx
callq 0x4120
incq %r15
cmpq %r15, %r13
jne 0x11a0e
jmp 0x119ef
movslq %r13d, %rdi
movl $0x8, %esi
callq 0x4130
movq %rax, 0x30(%r15)
movq (%rbx,%rbp,8), %r14
cmpl $0x0, (%r14)
jle 0x119ef
xorl %r13d, %r13d
movl $0x8, %esi
movq 0x8(%rsp), %rdi
callq 0x4130
movq 0x30(%r14), %rcx
movq %rax, (%rcx,%r13,8)
incq %r13
movq (%rbx,%rbp,8), %r14
movslq (%r14), %rax
cmpq %rax, %r13
jl 0x11a4b
jmp 0x119ef
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::setGradPI(FitBit*)
void HMMProblem::setGradPI(FitBit *fb){
    if(this->p->block_fitting[0]>0) return;
    NDAT t = 0, ndat = 0;
    NPAR i, o;
    struct data* dt;
    for(NCAT x=0; x<fb->xndat; x++) {
        dt = fb->x_data[x];
        if( dt->cnt!=0 ) continue;
        ndat += dt->n;
        o = this->p->dat_obs[ dt->ix[t] ];//->get( dt->ix[t] );
        for(i=0; i<this->p->nS; i++) {
            fb->gradPI[i] -= dt->beta[t][i] * ((o<0)?1:fb->B[i][o]) / safe0num(dt->p_O_param);
        }
    }
    if( this->p->Cslices>0 ) // penalty
        fb->addL2Penalty(FBV_PI, this->p, (NUMBER)ndat);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x88(%rdi), %rax
cmpb $0x0, 0x981(%rax)
jle 0x1226d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x0, 0xe8(%rsi)
jle 0x12362
xorl %r15d, %r15d
xorl %ecx, %ecx
movq 0xf0(%rbx), %rax
movq (%rax,%r15,8), %r12
cmpl $0x0, 0x4(%r12)
jne 0x12346
movq 0x88(%r14), %rax
addl (%r12), %ecx
cmpb $0x0, 0x8b8(%rax)
jle 0x12346
movl %ecx, 0xc(%rsp)
movq 0x88(%r14), %rax
movq 0x870(%rax), %rax
movq 0x10(%r12), %rcx
movslq (%rcx), %rcx
movzbl (%rax,%rcx), %r13d
xorl %ebp, %ebp
movsd 0x22613(%rip), %xmm0    # 0x348f0
testb %r13b, %r13b
js 0x122f0
movq 0x20(%rbx), %rax
movq (%rax,%rbp,8), %rax
movsd (%rax,%r13,8), %xmm0
movq 0x30(%r12), %rax
movq (%rax), %rax
mulsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x48(%r12), %xmm0
callq 0x8d88
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
movq 0x58(%rbx), %rax
movsd (%rax,%rbp,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rbp,8)
incq %rbp
movq 0x88(%r14), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %rbp
jl 0x122d5
movl 0xc(%rsp), %ecx
incq %r15
movslq 0xe8(%rbx), %rax
cmpq %rax, %r15
jl 0x12285
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
jmp 0x12366
xorpd %xmm0, %xmm0
movq 0x88(%r14), %rdx
cmpb $0x0, 0x42(%rdx)
jle 0x1225e
movq %rbx, %rdi
movl $0x1, %esi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb936
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::setGradA(FitBit*)
void HMMProblem::setGradA (FitBit *fb){
    if(this->p->block_fitting[1]>0) return;
    NDAT t, ndat = 0;
    NPAR o, i, j;
    struct data* dt;
    for(NCAT x=0; x<fb->xndat; x++) {
        dt = fb->x_data[x];
        if( dt->cnt!=0 ) continue;
        ndat += dt->n;
        for(t=1; t<dt->n; t++) {
            o = this->p->dat_obs[ dt->ix[t] ];//->get( dt->ix[t] );
            for(i=0; i<this->p->nS; i++)
                for(j=0; j<this->p->nS; j++)
                    fb->gradA[i][j] -= dt->beta[t][j] * ((o<0)?1:fb->B[j][o]) * dt->alpha[t-1][i] / safe0num(dt->p_O_param);
        }
    }
    if( this->p->Cslices>0 ) // penalty
        fb->addL2Penalty(FBV_A, this->p, (NUMBER)ndat);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x88(%rdi), %rax
cmpb $0x0, 0x982(%rax)
jle 0x123bf
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rbp
movq %rdi, %rbx
cmpl $0x0, 0xe8(%rsi)
jle 0x12546
xorl %ecx, %ecx
xorl %edx, %edx
movq 0xf0(%rbp), %rax
movq (%rax,%rcx,8), %r12
cmpl $0x0, 0x4(%r12)
jne 0x1252a
movl (%r12), %eax
addl %eax, %edx
cmpl $0x2, %eax
jl 0x1252a
movl %edx, 0x14(%rsp)
movq %rcx, 0x18(%rsp)
movl $0x1, %eax
movq %rax, 0x8(%rsp)
movq 0x88(%rbx), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x12507
movq 0x88(%rbx), %rax
movq 0x870(%rax), %rax
movq 0x10(%r12), %rcx
movq 0x8(%rsp), %rdx
movslq (%rcx,%rdx,4), %rcx
movzbl (%rax,%rcx), %r13d
xorl %r15d, %r15d
movq 0x88(%rbx), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x124ec
xorl %r14d, %r14d
movsd 0x2248a(%rip), %xmm0    # 0x348f0
testb %r13b, %r13b
js 0x12479
movq 0x20(%rbp), %rax
movq (%rax,%r14,8), %rax
movsd (%rax,%r13,8), %xmm0
movq 0x30(%r12), %rax
movq 0x8(%rsp), %rdx
movq (%rax,%rdx,8), %rax
mulsd (%rax,%r14,8), %xmm0
movq 0x28(%r12), %rax
movq -0x8(%rax,%rdx,8), %rax
mulsd (%rax,%r15,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x48(%r12), %xmm0
callq 0x8d88
movsd 0x20(%rsp), %xmm1
divsd %xmm0, %xmm1
movq 0x60(%rbp), %rax
movq (%rax,%r15,8), %rax
movsd (%rax,%r14,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax,%r14,8)
incq %r14
movq 0x88(%rbx), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r14
jl 0x1245e
incq %r15
movq 0x88(%rbx), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jl 0x12447
movq 0x8(%rsp), %rdx
incq %rdx
movslq (%r12), %rax
movq %rdx, 0x8(%rsp)
cmpq %rax, %rdx
jl 0x1240f
movq 0x18(%rsp), %rcx
movl 0x14(%rsp), %edx
incq %rcx
movslq 0xe8(%rbp), %rax
cmpq %rax, %rcx
jl 0x123d6
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
jmp 0x1254a
xorpd %xmm0, %xmm0
movq 0x88(%rbx), %rdx
cmpb $0x0, 0x42(%rdx)
jle 0x123b0
movq %rbp, %rdi
movl $0x2, %esi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb936
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::setGradB(FitBit*)
void HMMProblem::setGradB (FitBit *fb){
    if(this->p->block_fitting[2]>0) return;
    NDAT t, ndat = 0;
	NPAR o, o0, i;//, j;
    struct data* dt;
    for(NCAT x=0; x<fb->xndat; x++) {
        dt = fb->x_data[x];
        if( dt->cnt!=0 ) continue;
        ndat += dt->n;
//        for(t=0; t<dt->n; t++) { // old
        for(t=0; t<dt->n; t++) { // Levinson MMFST
            o  = this->p->dat_obs[ dt->ix[t] ];//->get( dt->ix[t] );
            o0 = this->p->dat_obs[ dt->ix[0] ];//->get( dt->ix[t] );
            if(o<0) // if no observation -- skip
                continue;
            for(i=0; i<this->p->nS; i++)
                fb->gradB[i][o] -= dt->alpha[t][i] * dt->beta[t][i] / safe0num(dt->p_O_param * fb->B[i][o]); // old
//            for(j=0; j<this->p->nS; j++)
//                if(t==0) {
//                    fb->gradB[j][o] -= (o0==o) * fb->pi[j] * dt->beta[0][j];
//                } else {
//                    for(i=0; i<this->p->nS; i++)
//                        fb->gradB[j][o] -= ( dt->alpha[t-1][i] * fb->A[i][j] * dt->beta[t][j] /*+ (o0==o) * getPI(dt,j) * dt->beta[0][j]*/ ) / safe0num(dt->p_O_param); // Levinson MMFST
//                }
        }
    }
    if( this->p->Cslices>0 ) // penalty
        fb->addL2Penalty(FBV_B, this->p, (NUMBER)ndat);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x88(%rdi), %rax
cmpb $0x0, 0x983(%rax)
jle 0x125a3
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x0, 0xe8(%rsi)
jle 0x126cc
xorl %ecx, %ecx
xorl %edx, %edx
movq 0xf0(%rbx), %rax
movq (%rax,%rcx,8), %r12
cmpl $0x0, 0x4(%r12)
jne 0x126b0
movl (%r12), %eax
addl %eax, %edx
testl %eax, %eax
jle 0x126b0
movl %edx, 0x4(%rsp)
movq %rcx, 0x8(%rsp)
xorl %r13d, %r13d
movq 0x88(%r14), %rax
movq 0x870(%rax), %rax
movq 0x10(%r12), %rcx
movslq (%rcx,%r13,4), %rcx
movsbq (%rax,%rcx), %rbp
testq %rbp, %rbp
js 0x12697
movq 0x88(%r14), %rax
cmpb $0x0, 0x8b8(%rax)
jle 0x12697
xorl %r15d, %r15d
movq 0x28(%r12), %rax
movq 0x30(%r12), %rcx
movq (%rax,%r13,8), %rax
movsd (%rax,%r15,8), %xmm0
movq (%rcx,%r13,8), %rax
mulsd (%rax,%r15,8), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x48(%r12), %xmm0
movq 0x20(%rbx), %rax
movq (%rax,%r15,8), %rax
mulsd (%rax,%rbp,8), %xmm0
callq 0x8d88
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
movq 0x68(%rbx), %rax
movq (%rax,%r15,8), %rax
movsd (%rax,%rbp,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rbp,8)
incq %r15
movq 0x88(%r14), %rax
movsbq 0x8b8(%rax), %rax
cmpq %rax, %r15
jl 0x12623
incq %r13
movslq (%r12), %rax
cmpq %rax, %r13
jl 0x125eb
movq 0x8(%rsp), %rcx
movl 0x4(%rsp), %edx
incq %rcx
movslq 0xe8(%rbx), %rax
cmpq %rax, %rcx
jl 0x125ba
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
jmp 0x126d0
xorpd %xmm0, %xmm0
movq 0x88(%r14), %rdx
cmpb $0x0, 0x42(%rdx)
jle 0x12594
movq %rbx, %rdi
movl $0x3, %esi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb936
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::computeGradients(FitBit*)
NDAT HMMProblem::computeGradients(FitBit *fb){
    fb->toZero(FBS_GRAD);
    
    NDAT ndat = computeAlphaAndPOParam(fb->xndat, fb->x_data);
    computeBeta(fb->xndat, fb->x_data);

    if(fb->pi != NULL && this->p->block_fitting[0]==0) setGradPI(fb);
    if(fb->A  != NULL && this->p->block_fitting[1]==0) setGradA(fb);
    if(fb->B  != NULL && this->p->block_fitting[2]==0) setGradB(fb);
    return ndat;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x3, %esi
callq 0xaf7c
movl 0xe8(%rbx), %esi
movq 0xf0(%rbx), %rdx
movq %r14, %rdi
callq 0x11a86
movl %eax, %ebp
movl 0xe8(%rbx), %esi
movq 0xf0(%rbx), %rdx
movq %r14, %rdi
callq 0x11dac
cmpq $0x0, 0x10(%rbx)
je 0x12762
movq 0x88(%r14), %rax
cmpb $0x0, 0x981(%rax)
jne 0x12762
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x28(%rax)
cmpq $0x0, 0x18(%rbx)
je 0x12785
movq 0x88(%r14), %rax
cmpb $0x0, 0x982(%rax)
jne 0x12785
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x30(%rax)
cmpq $0x0, 0x20(%rbx)
je 0x127a8
movq 0x88(%r14), %rax
cmpb $0x0, 0x983(%rax)
jne 0x127a8
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x38(%rax)
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::computeGradientsBig(FitBit**, int)
NDAT HMMProblem::computeGradientsBig(FitBit **fbs, NCAT nfbs){
    NCAT xndat = this->p->nSeq;
    struct data** x_data = this->p->k_data;
//    NPAR kg_flag = -1;
   
	NCAT x;
    
//    switch(this->p->structure)
//    {
//        case STRUCTURE_SKILL:
//            kg_flag = 0;
//            break;
//        case STRUCTURE_GROUP:
//            kg_flag = 1;
//            break;
//    }

    // there are as many fbs as skills or groups in this setup
    for(x=0; x<nfbs; x++)
        fbs[x]->toZero(FBS_GRAD);
    
    NDAT ndat = computeAlphaAndPOParam(xndat, x_data);
    computeBeta(xndat, x_data);

    
	for(x=0; x<nfbs; x++) {
        if(fbs[x]->pi != NULL && this->p->block_fitting[0]==0) setGradPI(fbs[x]);
        if(fbs[x]->A  != NULL && this->p->block_fitting[1]==0) setGradA (fbs[x]);
        if(fbs[x]->B  != NULL && this->p->block_fitting[2]==0) setGradB (fbs[x]);
    }// for all sequences
    return ndat;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movq 0x88(%rdi), %rax
movl 0x8dc(%rax), %ecx
movl %ecx, 0x4(%rsp)
movq 0x8f0(%rax), %r13
movl %edx, %ebp
testl %edx, %edx
jle 0x127fb
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rdi
movl $0x3, %esi
callq 0xaf7c
incq %r12
cmpq %r12, %rbp
jne 0x127e5
movq %r14, %rdi
movl 0x4(%rsp), %r12d
movl %r12d, %esi
movq %r13, %rdx
callq 0x11a86
movl %eax, (%rsp)
movq %r14, %rdi
movl %r12d, %esi
movq %r13, %rdx
callq 0x11dac
testl %r15d, %r15d
jle 0x1289b
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rsi
cmpq $0x0, 0x10(%rsi)
je 0x1284b
movq 0x88(%r14), %rax
cmpb $0x0, 0x981(%rax)
jne 0x1284b
movq (%r14), %rax
movq %r14, %rdi
callq *0x28(%rax)
movq (%rbx,%r15,8), %rsi
cmpq $0x0, 0x18(%rsi)
je 0x1286f
movq 0x88(%r14), %rax
cmpb $0x0, 0x982(%rax)
jne 0x1286f
movq (%r14), %rax
movq %r14, %rdi
callq *0x30(%rax)
movq (%rbx,%r15,8), %rsi
cmpq $0x0, 0x20(%rsi)
je 0x12893
movq 0x88(%r14), %rax
cmpb $0x0, 0x983(%rax)
jne 0x12893
movq (%r14), %rax
movq %r14, %rdi
callq *0x38(%rax)
incq %r15
cmpq %r15, %rbp
jne 0x12827
movl (%rsp), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/HMMProblem.cpp
// Function: HMMProblem::fit()
void HMMProblem::fit() {
    NUMBER* loglik_rmse = init1D<NUMBER>(2);
    FitNullSkill(loglik_rmse, false /*do RMSE*/);
    switch(this->p->solver)
    {
        case METHOD_BW: // Conjugate Gradient Descent
            loglik_rmse[0] += BaumWelch();
            break;
        case METHOD_GD: // Gradient Descent
        case METHOD_CGD: // Conjugate Gradient Descent
        case METHOD_GDL: // Gradient Descent, Lagrange
        case METHOD_GBB: // Brzilai Borwein Gradient Method
            loglik_rmse[0] += GradientDescent();
            break;
        default:
            fprintf(stderr,"Solver specified is not supported.\n");
            break;
    }
    this->neg_log_lik = loglik_rmse[0];
    free(loglik_rmse);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x2, %edi
movl $0x8, %esi
callq 0x4130
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x1442c
movq 0x88(%rbx), %rax
movzbl 0x3f(%rax), %eax
leal -0x2(%rax), %ecx
cmpl $0x4, %ecx
jae 0x14416
movq (%rbx), %rax
movq %rbx, %rdi
callq *0xa0(%rax)
addsd (%r14), %xmm0
movsd %xmm0, (%r14)
movsd (%r14), %xmm0
movsd %xmm0, 0x20(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x42a0
cmpl $0x1, %eax
jne 0x14425
movq %rbx, %rdi
callq 0x146dc
jmp 0x143f3
callq 0x4c23
jmp 0x143fd