// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/FitBit.cpp
// Function: FitBit::doLog10ScaleGentleByRow(FIT_BIT_SLOT)
void FitBit::doLog10ScaleGentleByRow(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);
	
	
	NPAR nS = this->nS, nO = this->nO;
	NPAR n_scales = (NPAR)2*nS + 1;
	NUMBER* scales = Calloc(NUMBER, n_scales);
	
	
	if(this->pi != NULL)
		scales[0] = doLog10Scale1DGentle(a_PI, this->pi, nS);
	if(this->A  != NULL) {
		for(NPAR i=0; i<nS; i++) {
			scales[i+1] = doLog10Scale1DGentle(a_A[i], this->A[i], nS);
		}
	}
	if(this->B  != NULL) {
		for(NPAR i=0; i<nS; i++) {
			scales[i+1+nS] = doLog10Scale1DGentle(a_B[i], this->B[i], nO);
		}
	}
	
	for(NPAR i=0; i<nS; i++) {
		if(this->pi != NULL) { a_PI[i] *= scales[0]; }
		if(this->A  != NULL) for(NPAR j=0; j<nS; j++) { a_A[i][j] *= scales[i+1]; }
		if(this->B  != NULL) for(NPAR m=0; m<nO; m++) { a_B[i][m] *= scales[i+1+nS]; }
	}
	
	free(scales);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorl %eax, %eax
leaq 0x20(%rsp), %rdx
movq %rax, (%rdx)
leaq 0x18(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x10(%rsp), %r8
movq %rax, (%r8)
callq 0xaff2
movzbl 0x1(%rbx), %r15d
movzbl (%rbx), %r12d
leal (%r15,%r15), %eax
incb %al
movsbq %al, %rdi
movl $0x8, %esi
callq 0x4130
movq %rax, %r14
movq %rbx, (%rsp)
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0xb7d8
movq 0x20(%rsp), %rdi
movsbl %r15b, %edx
callq 0x93b6
movsd %xmm0, (%r14)
movq (%rsp), %rsi
cmpq $0x0, 0x18(%rsi)
je 0xb81a
testb %r15b, %r15b
jle 0xb81a
movq 0x18(%rsp), %r13
xorl %ebx, %ebx
movsbl %r15b, %ebp
movq (%r13,%rbx,8), %rdi
movq 0x18(%rsi), %rax
movq (%rax,%rbx,8), %rsi
movl %ebp, %edx
callq 0x93b6
movq (%rsp), %rsi
movsd %xmm0, 0x8(%r14,%rbx,8)
incq %rbx
cmpq %rbx, %r15
jne 0xb7f3
movq %r14, 0x8(%rsp)
cmpq $0x0, 0x20(%rsi)
sete %al
testb %r15b, %r15b
setle %cl
orb %al, %cl
jne 0xb870
movq 0x10(%rsp), %r13
movq 0x8(%rsp), %rax
leaq (%rax,%r15,8), %rbx
addq $0x8, %rbx
xorl %r14d, %r14d
movsbl %r12b, %ebp
movq (%r13,%r14,8), %rdi
movq 0x20(%rsi), %rax
movq (%rax,%r14,8), %rsi
movl %ebp, %edx
callq 0x93b6
movq (%rsp), %rsi
movsd %xmm0, (%rbx,%r14,8)
incq %r14
cmpq %r14, %r15
jne 0xb84a
testb %r15b, %r15b
movq 0x8(%rsp), %rdi
jle 0xb923
movq 0x10(%rsi), %rax
movq 0x18(%rsi), %rcx
movq 0x20(%rsp), %rdx
cmpq $0x0, 0x20(%rsi)
movq 0x18(%rsp), %rsi
sete %r9b
testb %r12b, %r12b
setle %bpl
movq 0x10(%rsp), %r8
orb %r9b, %bpl
leaq (%rdi,%r15,8), %r9
addq $0x8, %r9
xorl %r10d, %r10d
testq %rax, %rax
je 0xb8c8
movsd (%rdi), %xmm0
mulsd (%rdx,%r10,8), %xmm0
movsd %xmm0, (%rdx,%r10,8)
testq %rcx, %rcx
je 0xb8f2
movsd 0x8(%rdi,%r10,8), %xmm0
movq (%rsi,%r10,8), %r11
xorl %ebx, %ebx
movsd (%r11,%rbx,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%r11,%rbx,8)
incq %rbx
cmpq %rbx, %r15
jne 0xb8da
testb %bpl, %bpl
jne 0xb91b
movsd (%r9,%r10,8), %xmm0
movq (%r8,%r10,8), %r11
xorl %ebx, %ebx
movsd (%r11,%rbx,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%r11,%rbx,8)
incq %rbx
cmpq %rbx, %r12
jne 0xb903
incq %r10
cmpq %r15, %r10
jne 0xb8b3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x42a0