double checkeig(double *err, struct vtx_data **A, double *y, int n,
                double lambda, double *vwsqrt, double *work) {
  double resid;
  double normy;
  double ch_norm();
  void splarax(), scadd();
  splarax(err, A, n, y, vwsqrt, work);
  scadd(err, 1, n, -lambda, y);
  normy = ch_norm(y, 1, n);
  resid = ch_norm(err, 1, n) / normy;
  return (resid);
}


x86 assembly (clang, -O0):
<checkeig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    $0x0,%al
call   1040 <splarax@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x1,%al
call   1050 <scadd@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <ch_norm@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <ch_norm@plt>
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkeig>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movaps %xmm0,(%rsp)
mov    %ecx,%ebx
mov    %rdx,%r15
mov    %rdi,%r14
mov    %ecx,%edx
mov    %r15,%rcx
xor    %eax,%eax
call   1040 <splarax@plt>
movapd (%rsp),%xmm0
xorpd  0xea2(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
mov    %r15,%rcx
mov    $0x1,%al
call   1050 <scadd@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <ch_norm@plt>
movsd  %xmm0,(%rsp)
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <ch_norm@plt>
divsd  (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.vtx_data = type opaque
define double @checkeig(double* %0, %struct.vtx_data** %1, double* %2, i32 %3, double %4, double* %5, double* %6) {
%8 = alloca double*
%9 = alloca %struct.vtx_data**
%10 = alloca double*
%11 = alloca i32
%12 = alloca double
%13 = alloca double*
%14 = alloca double*
%15 = alloca double
%16 = alloca double
store double* %0, double** %8
store %struct.vtx_data** %1, %struct.vtx_data*** %9
store double* %2, double** %10
store i32 %3, i32* %11
store double %4, double* %12
store double* %5, double** %13
store double* %6, double** %14
%17 = load double*, double** %8
%18 = load %struct.vtx_data**, %struct.vtx_data*** %9
%19 = load i32, i32* %11
%20 = load double*, double** %10
%21 = load double*, double** %13
%22 = load double*, double** %14
%23 = load double*, double** %8
%24 = load i32, i32* %11
%25 = load double, double* %12
%26 = fneg double %25
%27 = load double*, double** %10
%28 = load double*, double** %10
%29 = load i32, i32* %11
%30 = call double (double*, i32, i32, ...) bitcast (double (...)* @ch_norm to double (double*, i32, i32, ...)*)(double* %28, i32 1, i32 %29)
store double %30, double* %16
%31 = load double*, double** %8
%32 = load i32, i32* %11
%33 = call double (double*, i32, i32, ...) bitcast (double (...)* @ch_norm to double (double*, i32, i32, ...)*)(double* %31, i32 1, i32 %32)
%34 = load double, double* %16
%35 = fdiv double %33, %34
store double %35, double* %15
%36 = load double, double* %15
ret double %36
}

LLVM IR (-O2):
%struct.vtx_data = type opaque
define double @checkeig(double* %0, %struct.vtx_data** %1, double* %2, i32 %3, double %4, double* %5, double* %6) {
tail call void (double*, %struct.vtx_data**, i32, double*, double*, double*, ...) bitcast (void (...)* @splarax to void (double*, %struct.vtx_data**, i32, double*, double*, double*, ...)*)(double* %0, %struct.vtx_data** %1, i32 %3, double* %2, double* %5, double* %6)
%8 = fneg double %4
tail call void (double*, i32, i32, double, double*, ...) bitcast (void (...)* @scadd to void (double*, i32, i32, double, double*, ...)*)(double* %0, i32 1, i32 %3, double %8, double* %2)
%9 = tail call double (double*, i32, i32, ...) bitcast (double (...)* @ch_norm to double (double*, i32, i32, ...)*)(double* %2, i32 1, i32 %3)
%10 = tail call double (double*, i32, i32, ...) bitcast (double (...)* @ch_norm to double (double*, i32, i32, ...)*)(double* %0, i32 1, i32 %3)
%11 = fdiv double %10, %9
ret double %11
}