// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
decl %esi
cmpl $0x8, %esi
ja 0xb757
movl %esi, %eax
leaq 0x285b9(%rip), %rcx     # 0x33ce8
movq (%rcx,%rax,8), %rcx
leaq 0x285f6(%rip), %rdx     # 0x33d30
movq (%rdx,%rax,8), %rdx
leaq 0x28633(%rip), %rsi     # 0x33d78
movq (%rsi,%rax,8), %rax
movq (%r12,%rcx), %r15
movq (%r12,%rdx), %rcx
movq (%r12,%rax), %r14
jmp 0xb75f
xorl %r15d, %r15d
xorl %ecx, %ecx
xorl %r14d, %r14d
movq %rcx, 0x8(%rsp)
movzbl 0x1(%r12), %ebx
movzbl (%r12), %r13d
leal (%rbx,%rbx), %eax
incb %al
movsbq %al, %rdi
movl $0x8, %esi
callq 0x4130
movq %rax, %rbp
movq 0x10(%r12), %rsi
testq %rsi, %rsi
je 0xb79f
movsbl %bl, %edx
movq %r15, %rdi
callq 0x9418
movsd %xmm0, (%rbp)
movq %r15, 0x18(%rsp)
movq %r14, 0x10(%rsp)
cmpq $0x0, 0x18(%r12)
movq %r12, %r15
je 0xb7eb
testb %bl, %bl
jle 0xb8f3
xorl %r12d, %r12d
movsbl %bl, %r14d
movq 0x8(%rsp), %rax
movq (%rax,%r12,8), %rdi
movq 0x18(%r15), %rax
movq (%rax,%r12,8), %rsi
movl %r14d, %edx
callq 0x9418
movsd %xmm0, 0x8(%rbp,%r12,8)
incq %r12
cmpq %r12, %rbx
jne 0xb7c3
movq %rbp, (%rsp)
cmpq $0x0, 0x20(%r15)
sete %al
testb %bl, %bl
setle %cl
orb %al, %cl
movq 0x10(%rsp), %r12
jne 0xb843
movq (%rsp), %rax
leaq (%rax,%rbx,8), %rax
addq $0x8, %rax
movq %rax, 0x20(%rsp)
xorl %r14d, %r14d
movsbl %r13b, %ebp
movq (%r12,%r14,8), %rdi
movq 0x20(%r15), %rax
movq (%rax,%r14,8), %rsi
movl %ebp, %edx
callq 0x9418
movq 0x20(%rsp), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0xb81d
testb %bl, %bl
movq 0x18(%rsp), %r10
movq 0x8(%rsp), %r11
movq (%rsp), %rbp
jle 0xb8f3
movq 0x10(%r15), %rax
movq 0x18(%r15), %rcx
cmpq $0x0, 0x20(%r15)
sete %sil
testb %r13b, %r13b
setle %dl
orb %sil, %dl
leaq 0x8(,%rbx,8), %rsi
addq %rbp, %rsi
xorl %r15d, %r15d
testq %rax, %rax
je 0xb897
movsd (%rbp), %xmm0
mulsd (%r10,%r15,8), %xmm0
movsd %xmm0, (%r10,%r15,8)
testq %rcx, %rcx
je 0xb8c2
movsd 0x8(%rbp,%r15,8), %xmm0
movq (%r11,%r15,8), %r8
xorl %r9d, %r9d
movsd (%r8,%r9,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%r8,%r9,8)
incq %r9
cmpq %r9, %rbx
jne 0xb8aa
testb %dl, %dl
jne 0xb8eb
movsd (%rsi,%r15,8), %xmm0
movq (%r12,%r15,8), %r8
xorl %r9d, %r9d
movsd (%r8,%r9,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%r8,%r9,8)
incq %r9
cmpq %r9, %r13
jne 0xb8d3
incq %r15
cmpq %rbx, %r15
jne 0xb881
movq %rbp, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x42a0
nop