// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/RNBasics/RNSvd.cpp
// Function: gaps::householder_zero_row(double*, double*, int, int, int, int, double*)
void householder_zero_row(RNScalar *a,RNScalar *v,int i,int j,int m,int n,RNScalar *hv)
{
    RNScalar scale, sigma,snorm, f, h, s, dot;
    int k,l;

    for (scale=0, k=j; k<n; k++) scale += ((RNScalar) fabs(REF2D(a,m,n,i,k)));
    if (!scale) return;

    for (k=j; k<n; k++) hv[k] = REF2D(a,m,n,i,k) / scale;
    for (sigma=0, k=j; k<n; k++) sigma += hv[k]*hv[k];

    f = hv[j];
    snorm = ((RNScalar) ((f > 0) ? -sqrt(sigma) : sqrt(sigma)));
    h = f*snorm - sigma;
    hv[j] = f - snorm;

    REF2D(a,m,n,i,j) = scale * snorm;
    for (k=j+1; k<n; k++) REF2D(a,m,n,i,k) = 0;

    for (k=i+1; k<m; k++) {
	for (dot=0, l=j; l<n; l++) dot += REF2D(a,m,n,k,l)*hv[l];
	s = dot/h;
	for (l=j; l<n; l++) REF2D(a,m,n,k,l) += s*hv[l];
    }

    for (k=0; k<n; k++) {
	for (dot=0, l=j; l<n; l++) dot += REF2D(v,n,n,l,k)*hv[l];
	s = dot/h;
	for (l=j; l<n; l++) REF2D(v,n,n,l,k) += s*hv[l];
    }
}

// Assembly:
cmpl %r9d, %ecx
jge 0x70280
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r9d, %ebx
movl %r8d, %ebp
movl %ecx, %r14d
movq %rsi, %r8
movq 0x70(%rsp), %r15
movl %r9d, %esi
imull %edx, %esi
movslq %ecx, %rcx
movslq %esi, %rax
movslq %r9d, %r13
leaq (%rdi,%rax,8), %rax
xorpd %xmm3, %xmm3
movapd 0x32248(%rip), %xmm0    # 0xa2270
movsd (%rax,%rcx,8), %xmm1
andpd %xmm0, %xmm1
addsd %xmm1, %xmm3
incq %rcx
cmpq %rcx, %r13
jne 0x70028
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm3
jne 0x7004d
jnp 0x70272
cmpl %ebx, %r14d
jge 0x70093
movslq %r14d, %rcx
movsd (%rax,%rcx,8), %xmm0
divsd %xmm3, %xmm0
movsd %xmm0, (%r15,%rcx,8)
incq %rcx
cmpq %rcx, %r13
jne 0x70055
cmpl %ebx, %r14d
jge 0x70093
movslq %r14d, %r12
xorpd %xmm0, %xmm0
movq %r12, %rax
movsd (%r15,%rax,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rax
cmpq %rax, %r13
jne 0x7007b
jmp 0x7009a
movslq %r14d, %r12
xorpd %xmm0, %xmm0
movsd (%r15,%r12,8), %xmm5
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
movq %r8, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
movl %edx, 0x4(%rsp)
movsd %xmm0, 0x30(%rsp)
jb 0x700c4
sqrtsd %xmm0, %xmm0
jmp 0x700fb
movl %esi, 0x8(%rsp)
movsd %xmm3, 0x28(%rsp)
movsd %xmm5, 0x20(%rsp)
callq 0xe340
movsd 0x20(%rsp), %xmm5
xorpd %xmm4, %xmm4
movsd 0x28(%rsp), %xmm3
movl 0x8(%rsp), %esi
movl 0x4(%rsp), %edx
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %r8
movapd 0x31f1d(%rip), %xmm1    # 0xa2020
xorpd %xmm0, %xmm1
cmpltsd %xmm5, %xmm4
andpd %xmm4, %xmm1
andnpd %xmm0, %xmm4
orpd %xmm1, %xmm4
movapd %xmm5, %xmm2
mulsd %xmm4, %xmm2
subsd %xmm4, %xmm5
movsd %xmm5, (%r15,%r12,8)
mulsd %xmm4, %xmm3
addl %r14d, %esi
movslq %esi, %rax
movsd %xmm3, (%rdi,%rax,8)
leal 0x1(%r14), %eax
cmpl %ebx, %eax
jge 0x70180
incl %esi
movslq %esi, %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %rdi
movl %ebx, %eax
subl %r14d, %eax
addl $-0x2, %eax
leaq 0x8(,%rax,8), %rdx
xorl %esi, %esi
movsd %xmm2, 0x8(%rsp)
callq 0xe260
movl 0x4(%rsp), %edx
movq 0x10(%rsp), %rdi
movsd 0x8(%rsp), %xmm2
movq 0x18(%rsp), %r8
subsd 0x30(%rsp), %xmm2
incl %edx
cmpl %ebp, %edx
jge 0x701f7
movslq %edx, %rax
movq %r13, %rcx
imulq %rax, %rcx
leaq (%rdi,%rcx,8), %rcx
leaq (,%r13,8), %rdx
cmpl %ebx, %r14d
jge 0x701ed
xorpd %xmm0, %xmm0
movq %r12, %rsi
movsd (%rcx,%rsi,8), %xmm1
mulsd (%r15,%rsi,8), %xmm1
addsd %xmm1, %xmm0
incq %rsi
cmpq %rsi, %r13
jne 0x701ae
cmpl %ebx, %r14d
jge 0x701ed
divsd %xmm2, %xmm0
movq %r12, %rsi
movsd (%r15,%rsi,8), %xmm1
mulsd %xmm0, %xmm1
addsd (%rcx,%rsi,8), %xmm1
movsd %xmm1, (%rcx,%rsi,8)
incq %rsi
cmpq %rsi, %r13
jne 0x701d1
incq %rax
addq %rdx, %rcx
cmpl %ebp, %eax
jne 0x701a2
testl %ebx, %ebx
jle 0x70272
movl %ebx, %eax
movq %r12, %rcx
imulq %rax, %rcx
leaq (%r8,%rcx,8), %rcx
leaq (,%rax,8), %rdx
xorl %esi, %esi
cmpl %ebx, %r14d
jge 0x70266
xorpd %xmm0, %xmm0
movq %rcx, %rdi
movq %r12, %r8
movsd (%rdi), %xmm1
mulsd (%r15,%r8,8), %xmm1
addsd %xmm1, %xmm0
incq %r8
addq %rdx, %rdi
cmpq %r8, %rax
jne 0x70221
cmpl %ebx, %r14d
jge 0x70266
divsd %xmm2, %xmm0
movq %rcx, %rdi
movq %r12, %r8
movsd (%r15,%r8,8), %xmm1
mulsd %xmm0, %xmm1
addsd (%rdi), %xmm1
movsd %xmm1, (%rdi)
incq %r8
addq %rdx, %rdi
cmpq %r8, %rax
jne 0x70249
incq %rsi
addq $0x8, %rcx
cmpq %rax, %rsi
jne 0x70212
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq