// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebx
movl %r8d, %ebp
movl %ecx, %r14d
movl %edx, %r8d
movq %rsi, %r9
movq %rdi, %r13
xorpd %xmm0, %xmm0
xorpd %xmm4, %xmm4
cmpl %ebx, %ecx
jge 0x70e05
movl %ebx, %ecx
imull %r8d, %ecx
movslq %r14d, %rax
movslq %ecx, %rdx
movslq %ebx, %rcx
leaq (,%rdx,8), %rdx
addq %r13, %rdx
movapd 0x31480(%rip), %xmm1    # 0xa2270
movsd (%rdx,%rax,8), %xmm2
andpd %xmm1, %xmm2
addsd %xmm2, %xmm4
incq %rax
cmpq %rax, %rcx
jne 0x70df0
ucomisd %xmm0, %xmm4
jne 0x70e11
jnp 0x71057
movq 0x60(%rsp), %r15
cmpl %ebx, %r14d
jge 0x70e4c
movl %ebx, %ecx
imull %r8d, %ecx
movslq %r14d, %rax
movslq %ecx, %rdx
movslq %ebx, %rcx
leaq (,%rdx,8), %rdx
addq %r13, %rdx
movsd (%rdx,%rax,8), %xmm0
divsd %xmm4, %xmm0
movsd %xmm0, (%r15,%rax,8)
incq %rax
cmpq %rax, %rcx
jne 0x70e35
movslq %r14d, %r12
xorpd %xmm2, %xmm2
xorpd %xmm0, %xmm0
cmpl %ebx, %r14d
jge 0x70e78
movslq %r14d, %rax
movslq %ebx, %rcx
movsd (%r15,%rax,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rax
cmpq %rax, %rcx
jne 0x70e62
movsd (%r15,%r12,8), %xmm5
ucomisd %xmm2, %xmm0
movq %r9, 0x10(%rsp)
movl %r8d, 0x4(%rsp)
movsd %xmm0, 0x20(%rsp)
jb 0x70e9a
sqrtsd %xmm0, %xmm0
jmp 0x70ec1
movsd %xmm4, 0x8(%rsp)
movsd %xmm5, 0x18(%rsp)
callq 0xe340
movsd 0x18(%rsp), %xmm5
movsd 0x8(%rsp), %xmm4
movl 0x4(%rsp), %r8d
movq 0x10(%rsp), %r9
movapd 0x31157(%rip), %xmm1    # 0xa2020
xorpd %xmm0, %xmm1
xorpd %xmm2, %xmm2
cmpltsd %xmm5, %xmm2
andpd %xmm2, %xmm1
andnpd %xmm0, %xmm2
orpd %xmm1, %xmm2
movapd %xmm5, %xmm3
mulsd %xmm2, %xmm3
subsd %xmm2, %xmm5
movsd %xmm5, (%r15,%r12,8)
mulsd %xmm2, %xmm4
movl %ebx, %eax
imull %r8d, %eax
leal (%rax,%r14), %ecx
movslq %ecx, %rcx
movsd %xmm4, (%r13,%rcx,8)
leal 0x1(%r14), %ecx
cmpl %ebx, %ecx
jge 0x70f53
addl %r14d, %eax
incl %eax
cltq
leaq (,%rax,8), %rdi
addq %r13, %rdi
movl %ebx, %eax
subl %r14d, %eax
addl $-0x2, %eax
leaq 0x8(,%rax,8), %rdx
xorl %esi, %esi
movsd %xmm3, 0x8(%rsp)
callq 0xe260
movl 0x4(%rsp), %r8d
movsd 0x8(%rsp), %xmm3
movq 0x10(%rsp), %r9
subsd 0x20(%rsp), %xmm3
incl %r8d
cmpl %ebp, %r8d
jge 0x70fdc
movslq %r14d, %rax
movslq %r8d, %rcx
movslq %ebx, %rdx
movq %rdx, %rsi
imulq %rcx, %rsi
leaq (,%rsi,8), %rsi
addq %r13, %rsi
leaq (,%rdx,8), %rdi
xorpd %xmm0, %xmm0
cmpl %ebx, %r14d
jge 0x70fa8
movq %rax, %r8
movsd (%rsi,%r8,8), %xmm1
mulsd (%r15,%r8,8), %xmm1
addsd %xmm1, %xmm0
incq %r8
cmpq %r8, %rdx
jne 0x70f90
cmpl %ebx, %r14d
jge 0x70fd2
divsd %xmm3, %xmm0
movq %rax, %r8
movsd (%r15,%r8,8), %xmm1
mulsd %xmm0, %xmm1
addsd (%rsi,%r8,8), %xmm1
movsd %xmm1, (%rsi,%r8,8)
incq %r8
cmpq %r8, %rdx
jne 0x70fb4
incq %rcx
addq %rdi, %rsi
cmpl %ebp, %ecx
jne 0x70f84
testl %ebx, %ebx
jle 0x71057
movl %ebx, %eax
movq %r12, %rcx
imulq %rax, %rcx
leaq (%r9,%rcx,8), %rcx
leaq (,%rax,8), %rdx
xorl %esi, %esi
xorpd %xmm0, %xmm0
cmpl %ebx, %r14d
jge 0x7101f
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 0x71006
cmpl %ebx, %r14d
jge 0x7104b
divsd %xmm3, %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 0x7102e
incq %rsi
addq $0x8, %rcx
cmpq %rax, %rsi
jne 0x70ff7
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq