// File: /workspace/github_cpp_makefile_star2_O2/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 $0x38, %rsp
movq %rdi, %r13
leaq 0x18(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x10(%rsp), %rcx
andq $0x0, (%rcx)
leaq 0x30(%rsp), %r8
andq $0x0, (%r8)
callq 0x8876
movsbl 0x1(%r13), %ebp
movb (%r13), %al
movb %al, 0x7(%rsp)
leal (,%rbp,2), %eax
incb %al
movsbq %al, %rdi
pushq $0x8
popq %rsi
callq 0x4120
movq %rax, %r14
movq 0x10(%r13), %rsi
testq %rsi, %rsi
je 0x8f7e
movq 0x18(%rsp), %rdi
movl %ebp, %edx
callq 0x6d73
movsd %xmm0, (%r14)
cmpq $0x0, 0x18(%r13)
je 0x8fbf
movq 0x10(%rsp), %rbx
xorl %r12d, %r12d
testb %bpl, %bpl
movl $0x0, %eax
cmovgl %ebp, %eax
movslq %eax, %r15
cmpq %r12, %r15
je 0x8fbf
movq (%rbx,%r12,8), %rdi
movq 0x18(%r13), %rax
movq (%rax,%r12,8), %rsi
movl %ebp, %edx
callq 0x6d73
movsd %xmm0, 0x8(%r14,%r12,8)
incq %r12
jmp 0x8f9b
xorl %r12d, %r12d
testb %bpl, %bpl
movl $0x0, %eax
cmovgl %ebp, %eax
movq %r13, 0x8(%rsp)
cmpq $0x0, 0x20(%r13)
movq 0x30(%rsp), %r13
movzbl %al, %ebx
je 0x9040
movq %rbp, 0x20(%rsp)
movslq %ebp, %rax
leaq (%r14,%rax,8), %rax
addq $0x8, %rax
movq %rax, 0x28(%rsp)
xorl %r15d, %r15d
movsbl 0x7(%rsp), %ebp
cmpq %r15, %rbx
je 0x902c
movq (%r13,%r15,8), %rdi
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax,%r15,8), %rsi
movl %ebp, %edx
callq 0x6d73
movq 0x28(%rsp), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
jmp 0x8ffe
movq 0x8(%rsp), %rdx
cmpq $0x0, 0x20(%rdx)
sete %al
movq 0x20(%rsp), %rbp
jmp 0x9047
movb $0x1, %al
movq 0x8(%rsp), %rdx
movq 0x10(%rdx), %rcx
movq 0x18(%rdx), %rdx
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
incl %ebp
movb 0x7(%rsp), %r9b
movzbl %r9b, %r8d
testb %r9b, %r9b
cmovlel %r12d, %r8d
movzbl %r8b, %r8d
cmpq %rbx, %r12
je 0x90e7
testq %rcx, %rcx
je 0x908a
movsd (%r14), %xmm0
mulsd (%rsi,%r12,8), %xmm0
movsd %xmm0, (%rsi,%r12,8)
testq %rdx, %rdx
je 0x90b3
xorl %r9d, %r9d
cmpq %r9, %rbx
je 0x90b3
movsd 0x8(%r14,%r12,8), %xmm0
movq (%rdi,%r12,8), %r10
mulsd (%r10,%r9,8), %xmm0
movsd %xmm0, (%r10,%r9,8)
incq %r9
jmp 0x9092
testb %al, %al
je 0x90bc
incq %r12
jmp 0x906f
leal (%r12,%rbp), %r9d
movslq %r9d, %r9
xorl %r10d, %r10d
cmpq %r10, %r8
je 0x90b7
movsd (%r14,%r9,8), %xmm0
movq (%r13,%r12,8), %r11
mulsd (%r11,%r10,8), %xmm0
movsd %xmm0, (%r11,%r10,8)
incq %r10
jmp 0x90c6
movq %r14, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4290
nop