; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/Numerics/FEM/src (dsrc2c)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@eigvns_.i = external hidden global i64, align 8

; Function Attrs: nounwind uwtable
define dso_local double @eigvns_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %11 = load ptr, ptr %7, align 8, !tbaa !5
  %12 = getelementptr inbounds double, ptr %11, i64 0
  %13 = load double, ptr %12, align 8, !tbaa !9
  %14 = fneg double %13
  %15 = load ptr, ptr %8, align 8, !tbaa !5
  %16 = getelementptr inbounds double, ptr %15, i64 0
  store double %14, ptr %16, align 8, !tbaa !9
  store i64 1, ptr @eigvns_.i, align 8, !tbaa !11
  br label %17

17:                                               ; preds = %59, %5
  %18 = load i64, ptr @eigvns_.i, align 8, !tbaa !11
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = load i64, ptr %19, align 8, !tbaa !11
  %21 = icmp slt i64 %18, %20
  br i1 %21, label %22, label %62

22:                                               ; preds = %17
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = load i64, ptr @eigvns_.i, align 8, !tbaa !11
  %25 = shl i64 %24, 1
  %26 = getelementptr inbounds double, ptr %23, i64 %25
  %27 = load double, ptr %26, align 8, !tbaa !9
  %28 = fneg double %27
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = load i64, ptr @eigvns_.i, align 8, !tbaa !11
  %31 = getelementptr inbounds double, ptr %29, i64 %30
  store double %28, ptr %31, align 8, !tbaa !9
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = load i64, ptr @eigvns_.i, align 8, !tbaa !11
  %34 = shl i64 %33, 1
  %35 = add nsw i64 %34, 1
  %36 = getelementptr inbounds double, ptr %32, i64 %35
  %37 = load double, ptr %36, align 8, !tbaa !9
  %38 = fcmp oge double %37, 0.000000e+00
  br i1 %38, label %39, label %46

39:                                               ; preds = %22
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = load i64, ptr @eigvns_.i, align 8, !tbaa !11
  %42 = shl i64 %41, 1
  %43 = add nsw i64 %42, 1
  %44 = getelementptr inbounds double, ptr %40, i64 %43
  %45 = load double, ptr %44, align 8, !tbaa !9
  br label %54

46:                                               ; preds = %22
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = load i64, ptr @eigvns_.i, align 8, !tbaa !11
  %49 = shl i64 %48, 1
  %50 = add nsw i64 %49, 1
  %51 = getelementptr inbounds double, ptr %47, i64 %50
  %52 = load double, ptr %51, align 8, !tbaa !9
  %53 = fneg double %52
  br label %54

54:                                               ; preds = %46, %39
  %55 = phi double [ %45, %39 ], [ %53, %46 ]
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = load i64, ptr @eigvns_.i, align 8, !tbaa !11
  %58 = getelementptr inbounds double, ptr %56, i64 %57
  store double %55, ptr %58, align 8, !tbaa !9
  br label %59

59:                                               ; preds = %54
  %60 = load i64, ptr @eigvns_.i, align 8, !tbaa !11
  %61 = add nsw i64 %60, 1
  store i64 %61, ptr @eigvns_.i, align 8, !tbaa !11
  br label %17, !llvm.loop !13

62:                                               ; preds = %17
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = call i32 @v3p_netlib_tqlrat_(ptr noundef %63, ptr noundef %64, ptr noundef %65, ptr noundef %66)
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = getelementptr inbounds double, ptr %68, i64 0
  %70 = load double, ptr %69, align 8, !tbaa !9
  %71 = fneg double %70
  ret double %71
}

declare i32 @v3p_netlib_tqlrat_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@eigvns_.i = external hidden local_unnamed_addr global i64, align 8

; Function Attrs: nounwind uwtable
define dso_local double @eigvns_(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = load double, ptr %1, align 8, !tbaa !5
  %7 = fneg double %6
  store double %7, ptr %2, align 8, !tbaa !5
  store i64 1, ptr @eigvns_.i, align 8, !tbaa !9
  %8 = load i64, ptr %0, align 8, !tbaa !9
  %9 = icmp sgt i64 %8, 1
  br i1 %9, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %5, %.lr.ph
  %storemerge15 = phi i64 [ %22, %.lr.ph ], [ 1, %5 ]
  %.idx = shl i64 %storemerge15, 4
  %10 = getelementptr inbounds i8, ptr %1, i64 %.idx
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = fneg double %11
  %13 = getelementptr inbounds double, ptr %2, i64 %storemerge15
  store double %12, ptr %13, align 8, !tbaa !5
  %14 = shl nuw i64 %storemerge15, 1
  %15 = or disjoint i64 %14, 1
  %16 = getelementptr inbounds double, ptr %1, i64 %15
  %17 = load double, ptr %16, align 8, !tbaa !5
  %18 = fcmp ult double %17, 0.000000e+00
  %19 = fneg double %17
  %20 = select i1 %18, double %19, double %17
  %21 = getelementptr inbounds double, ptr %3, i64 %storemerge15
  store double %20, ptr %21, align 8, !tbaa !5
  %22 = add nuw nsw i64 %storemerge15, 1
  store i64 %22, ptr @eigvns_.i, align 8, !tbaa !9
  %23 = load i64, ptr %0, align 8, !tbaa !9
  %24 = icmp slt i64 %22, %23
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %5
  %25 = tail call i32 @v3p_netlib_tqlrat_(ptr noundef nonnull %0, ptr noundef nonnull %2, ptr noundef %3, ptr noundef %4) #2
  %26 = load double, ptr %2, align 8, !tbaa !5
  %27 = fneg double %26
  ret double %27
}

declare i32 @v3p_netlib_tqlrat_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass