; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/ThirdParty/VNL/src/vxl/v3p/netlib/sparse (spBuild)

; 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"

%struct.MatrixFrame = type { double, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i32, i32, ptr, ptr, i64, ptr, i32, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i8, i32, double, i32, i32, i32, i32, i32, i32, %struct.MatrixElement, ptr, i32, ptr, i32, ptr, i32, ptr, ptr }
%struct.MatrixElement = type { double, i32, i32, ptr, ptr, ptr }

@stdout = external global ptr, align 8
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [66 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [122 x i8], align 1
@spcMatrixIsNotValid = external global [0 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @spClear(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %6, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = icmp ne ptr %7, null
  br i1 %8, label %9, label %14

9:                                                ; preds = %1
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.MatrixFrame, ptr %10, i32 0, i32 17
  %12 = load i64, ptr %11, align 8, !tbaa !9
  %13 = icmp eq i64 %12, 3735928559
  br i1 %13, label %21, label %14

14:                                               ; preds = %9, %1
  %15 = load ptr, ptr @stdout, align 8, !tbaa !5
  %16 = call i32 @fflush(ptr noundef %15)
  %17 = load ptr, ptr @stderr, align 8, !tbaa !5
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 100, ptr noundef @spcMatrixIsNotValid) #5
  %19 = load ptr, ptr @stderr, align 8, !tbaa !5
  %20 = call i32 @fflush(ptr noundef %19)
  call void @abort() #6
  unreachable

21:                                               ; preds = %9
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.MatrixFrame, ptr %22, i32 0, i32 39
  %24 = load i32, ptr %23, align 4, !tbaa !15
  store i32 %24, ptr %5, align 4, !tbaa !16
  br label %25

25:                                               ; preds = %46, %21
  %26 = load i32, ptr %5, align 4, !tbaa !16
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %28, label %49

28:                                               ; preds = %25
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.MatrixFrame, ptr %29, i32 0, i32 15
  %31 = load ptr, ptr %30, align 8, !tbaa !17
  %32 = load i32, ptr %5, align 4, !tbaa !16
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds ptr, ptr %31, i64 %33
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  store ptr %35, ptr %4, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %39, %28
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %45

39:                                               ; preds = %36
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.MatrixElement, ptr %40, i32 0, i32 0
  store double 0.000000e+00, ptr %41, align 8, !tbaa !18
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.MatrixElement, ptr %42, i32 0, i32 4
  %44 = load ptr, ptr %43, align 8, !tbaa !19
  store ptr %44, ptr %4, align 8, !tbaa !5
  br label %36, !llvm.loop !20

45:                                               ; preds = %36
  br label %46

46:                                               ; preds = %45
  %47 = load i32, ptr %5, align 4, !tbaa !16
  %48 = add nsw i32 %47, -1
  store i32 %48, ptr %5, align 4, !tbaa !16
  br label %25, !llvm.loop !22

49:                                               ; preds = %25
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.MatrixFrame, ptr %50, i32 0, i32 40
  %52 = getelementptr inbounds %struct.MatrixElement, ptr %51, i32 0, i32 0
  store double 0.000000e+00, ptr %52, align 8, !tbaa !23
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.MatrixFrame, ptr %53, i32 0, i32 9
  store i32 0, ptr %54, align 4, !tbaa !24
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.MatrixFrame, ptr %55, i32 0, i32 13
  store i32 0, ptr %56, align 8, !tbaa !25
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.MatrixFrame, ptr %57, i32 0, i32 36
  store i32 0, ptr %58, align 8, !tbaa !26
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.MatrixFrame, ptr %59, i32 0, i32 37
  store i32 0, ptr %60, align 4, !tbaa !27
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.MatrixFrame, ptr %61, i32 0, i32 3
  %63 = load i32, ptr %62, align 8, !tbaa !28
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.MatrixFrame, ptr %64, i32 0, i32 32
  store i32 %63, ptr %65, align 4, !tbaa !29
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare i32 @fflush(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: noreturn nounwind
declare void @abort() #4

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 #3 = { nounwind "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 #4 = { noreturn nounwind "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 #5 = { nounwind }
attributes #6 = { noreturn 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !13, i64 104}
!10 = !{!"MatrixFrame", !11, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !6, i64 64, !6, i64 72, !12, i64 80, !12, i64 84, !6, i64 88, !6, i64 96, !13, i64 104, !6, i64 112, !12, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !12, i64 168, !12, i64 172, !12, i64 176, !12, i64 180, !12, i64 184, !12, i64 188, !7, i64 192, !12, i64 196, !11, i64 200, !12, i64 208, !12, i64 212, !12, i64 216, !12, i64 220, !12, i64 224, !12, i64 228, !14, i64 232, !6, i64 272, !12, i64 280, !6, i64 288, !12, i64 296, !6, i64 304, !12, i64 312, !6, i64 320, !6, i64 328}
!11 = !{!"double", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"MatrixElement", !11, i64 0, !12, i64 8, !12, i64 12, !6, i64 16, !6, i64 24, !6, i64 32}
!15 = !{!10, !12, i64 228}
!16 = !{!12, !12, i64 0}
!17 = !{!10, !6, i64 88}
!18 = !{!14, !11, i64 0}
!19 = !{!14, !6, i64 24}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = !{!10, !11, i64 232}
!24 = !{!10, !12, i64 52}
!25 = !{!10, !12, i64 80}
!26 = !{!10, !12, i64 216}
!27 = !{!10, !12, i64 220}
!28 = !{!10, !12, i64 16}
!29 = !{!10, !12, i64 196}


; 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"

@stdout = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [66 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [122 x i8], align 1
@spcMatrixIsNotValid = external global [0 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @spClear(ptr noundef %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %2

2:                                                ; preds = %1
  %3 = getelementptr inbounds i8, ptr %0, i64 104
  %4 = load i64, ptr %3, align 8, !tbaa !5
  %5 = icmp eq i64 %4, 3735928559
  br i1 %5, label %13, label %6

6:                                                ; preds = %2, %1
  %7 = load ptr, ptr @stdout, align 8, !tbaa !14
  %8 = tail call i32 @fflush(ptr noundef %7)
  %9 = load ptr, ptr @stderr, align 8, !tbaa !14
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 100, ptr noundef nonnull @spcMatrixIsNotValid) #3
  %11 = load ptr, ptr @stderr, align 8, !tbaa !14
  %12 = tail call i32 @fflush(ptr noundef %11)
  tail call void @abort() #4
  unreachable

13:                                               ; preds = %2
  %14 = getelementptr inbounds i8, ptr %0, i64 228
  %15 = load i32, ptr %14, align 4, !tbaa !15
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph25, label %._crit_edge26

.lr.ph25:                                         ; preds = %13
  %17 = getelementptr inbounds i8, ptr %0, i64 88
  %18 = load ptr, ptr %17, align 8, !tbaa !16
  %19 = zext nneg i32 %15 to i64
  %xtraiter = and i64 %19, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.prol.loopexit, label %.prol.preheader

.prol.preheader:                                  ; preds = %.lr.ph25
  %20 = getelementptr inbounds ptr, ptr %18, i64 %19
  %.01720.prol = load ptr, ptr %20, align 8, !tbaa !14
  %.not1921.prol = icmp eq ptr %.01720.prol, null
  br i1 %.not1921.prol, label %._crit_edge.prol, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.prol.preheader, %.lr.ph.prol
  %.01722.prol = phi ptr [ %.017.prol, %.lr.ph.prol ], [ %.01720.prol, %.prol.preheader ]
  store double 0.000000e+00, ptr %.01722.prol, align 8, !tbaa !17
  %21 = getelementptr inbounds i8, ptr %.01722.prol, i64 24
  %.017.prol = load ptr, ptr %21, align 8, !tbaa !14
  %.not19.prol = icmp eq ptr %.017.prol, null
  br i1 %.not19.prol, label %._crit_edge.prol, label %.lr.ph.prol, !llvm.loop !18

._crit_edge.prol:                                 ; preds = %.lr.ph.prol, %.prol.preheader
  %indvars.iv.next.prol = add nsw i64 %19, -1
  br label %.prol.loopexit

.prol.loopexit:                                   ; preds = %._crit_edge.prol, %.lr.ph25
  %indvars.iv.unr = phi i64 [ %19, %.lr.ph25 ], [ %indvars.iv.next.prol, %._crit_edge.prol ]
  %22 = icmp eq i32 %15, 1
  br i1 %22, label %._crit_edge26, label %.lr.ph25.new

.lr.ph25.new:                                     ; preds = %.prol.loopexit
  %invariant.gep = getelementptr i8, ptr %18, i64 -8
  br label %23

23:                                               ; preds = %._crit_edge.1, %.lr.ph25.new
  %indvars.iv = phi i64 [ %indvars.iv.unr, %.lr.ph25.new ], [ %indvars.iv.next.1, %._crit_edge.1 ]
  %24 = getelementptr inbounds ptr, ptr %18, i64 %indvars.iv
  %.01720 = load ptr, ptr %24, align 8, !tbaa !14
  %.not1921 = icmp eq ptr %.01720, null
  br i1 %.not1921, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %23, %.lr.ph
  %.01722 = phi ptr [ %.017, %.lr.ph ], [ %.01720, %23 ]
  store double 0.000000e+00, ptr %.01722, align 8, !tbaa !17
  %25 = getelementptr inbounds i8, ptr %.01722, i64 24
  %.017 = load ptr, ptr %25, align 8, !tbaa !14
  %.not19 = icmp eq ptr %.017, null
  br i1 %.not19, label %._crit_edge, label %.lr.ph, !llvm.loop !18

._crit_edge:                                      ; preds = %.lr.ph, %23
  %gep = getelementptr ptr, ptr %invariant.gep, i64 %indvars.iv
  %.01720.1 = load ptr, ptr %gep, align 8, !tbaa !14
  %.not1921.1 = icmp eq ptr %.01720.1, null
  br i1 %.not1921.1, label %._crit_edge.1, label %.lr.ph.1

.lr.ph.1:                                         ; preds = %._crit_edge, %.lr.ph.1
  %.01722.1 = phi ptr [ %.017.1, %.lr.ph.1 ], [ %.01720.1, %._crit_edge ]
  store double 0.000000e+00, ptr %.01722.1, align 8, !tbaa !17
  %26 = getelementptr inbounds i8, ptr %.01722.1, i64 24
  %.017.1 = load ptr, ptr %26, align 8, !tbaa !14
  %.not19.1 = icmp eq ptr %.017.1, null
  br i1 %.not19.1, label %._crit_edge.1, label %.lr.ph.1, !llvm.loop !18

._crit_edge.1:                                    ; preds = %.lr.ph.1, %._crit_edge
  %indvars.iv.next.1 = add nsw i64 %indvars.iv, -2
  %27 = icmp sgt i64 %indvars.iv, 2
  br i1 %27, label %23, label %._crit_edge26, !llvm.loop !20

._crit_edge26:                                    ; preds = %.prol.loopexit, %._crit_edge.1, %13
  %28 = getelementptr inbounds i8, ptr %0, i64 232
  store double 0.000000e+00, ptr %28, align 8, !tbaa !21
  %29 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 0, ptr %29, align 4, !tbaa !22
  %30 = getelementptr inbounds i8, ptr %0, i64 80
  store i32 0, ptr %30, align 8, !tbaa !23
  %31 = getelementptr inbounds i8, ptr %0, i64 216
  store i32 0, ptr %31, align 8, !tbaa !24
  %32 = getelementptr inbounds i8, ptr %0, i64 220
  store i32 0, ptr %32, align 4, !tbaa !25
  %33 = getelementptr inbounds i8, ptr %0, i64 16
  %34 = load i32, ptr %33, align 8, !tbaa !26
  %35 = getelementptr inbounds i8, ptr %0, i64 196
  store i32 %34, ptr %35, align 4, !tbaa !27
  ret void
}

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #2

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 = { nofree nounwind "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 = { noreturn nounwind "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 #3 = { cold nounwind }
attributes #4 = { noreturn 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, !12, i64 104}
!6 = !{!"MatrixFrame", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !11, i64 24, !11, i64 32, !11, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !11, i64 64, !11, i64 72, !10, i64 80, !10, i64 84, !11, i64 88, !11, i64 96, !12, i64 104, !11, i64 112, !10, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !8, i64 192, !10, i64 196, !7, i64 200, !10, i64 208, !10, i64 212, !10, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !13, i64 232, !11, i64 272, !10, i64 280, !11, i64 288, !10, i64 296, !11, i64 304, !10, i64 312, !11, i64 320, !11, i64 328}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!"MatrixElement", !7, i64 0, !10, i64 8, !10, i64 12, !11, i64 16, !11, i64 24, !11, i64 32}
!14 = !{!11, !11, i64 0}
!15 = !{!6, !10, i64 228}
!16 = !{!6, !11, i64 88}
!17 = !{!13, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = !{!6, !7, i64 232}
!22 = !{!6, !10, i64 52}
!23 = !{!6, !10, i64 80}
!24 = !{!6, !10, i64 216}
!25 = !{!6, !10, i64 220}
!26 = !{!6, !10, i64 16}
!27 = !{!6, !10, i64 196}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass