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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @spcCreateInternalVectors(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.MatrixFrame, ptr %4, i32 0, i32 39
  %6 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %6, ptr %3, align 4, !tbaa !15
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.MatrixFrame, ptr %7, i32 0, i32 22
  %9 = load ptr, ptr %8, align 8, !tbaa !16
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %26

11:                                               ; preds = %1
  %12 = load i32, ptr %3, align 4, !tbaa !15
  %13 = add nsw i32 %12, 1
  %14 = sext i32 %13 to i64
  %15 = mul i64 4, %14
  %16 = trunc i64 %15 to i32
  %17 = zext i32 %16 to i64
  %18 = call ptr @malloc(i64 noundef %17) #4
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.MatrixFrame, ptr %19, i32 0, i32 22
  store ptr %18, ptr %20, align 8, !tbaa !16
  %21 = icmp eq ptr %18, null
  br i1 %21, label %22, label %25

22:                                               ; preds = %11
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.MatrixFrame, ptr %23, i32 0, i32 9
  store i32 5, ptr %24, align 4, !tbaa !17
  br label %25

25:                                               ; preds = %22, %11
  br label %26

26:                                               ; preds = %25, %1
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.MatrixFrame, ptr %27, i32 0, i32 23
  %29 = load ptr, ptr %28, align 8, !tbaa !18
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %46

31:                                               ; preds = %26
  %32 = load i32, ptr %3, align 4, !tbaa !15
  %33 = add nsw i32 %32, 1
  %34 = sext i32 %33 to i64
  %35 = mul i64 4, %34
  %36 = trunc i64 %35 to i32
  %37 = zext i32 %36 to i64
  %38 = call ptr @malloc(i64 noundef %37) #4
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.MatrixFrame, ptr %39, i32 0, i32 23
  store ptr %38, ptr %40, align 8, !tbaa !18
  %41 = icmp eq ptr %38, null
  br i1 %41, label %42, label %45

42:                                               ; preds = %31
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.MatrixFrame, ptr %43, i32 0, i32 9
  store i32 5, ptr %44, align 4, !tbaa !17
  br label %45

45:                                               ; preds = %42, %31
  br label %46

46:                                               ; preds = %45, %26
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.MatrixFrame, ptr %47, i32 0, i32 24
  %49 = load ptr, ptr %48, align 8, !tbaa !19
  %50 = icmp eq ptr %49, null
  br i1 %50, label %51, label %66

51:                                               ; preds = %46
  %52 = load i32, ptr %3, align 4, !tbaa !15
  %53 = add nsw i32 %52, 2
  %54 = sext i32 %53 to i64
  %55 = mul i64 8, %54
  %56 = trunc i64 %55 to i32
  %57 = zext i32 %56 to i64
  %58 = call ptr @malloc(i64 noundef %57) #4
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.MatrixFrame, ptr %59, i32 0, i32 24
  store ptr %58, ptr %60, align 8, !tbaa !19
  %61 = icmp eq ptr %58, null
  br i1 %61, label %62, label %65

62:                                               ; preds = %51
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.MatrixFrame, ptr %63, i32 0, i32 9
  store i32 5, ptr %64, align 4, !tbaa !17
  br label %65

65:                                               ; preds = %62, %51
  br label %66

66:                                               ; preds = %65, %46
  %67 = load ptr, ptr %2, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.MatrixFrame, ptr %67, i32 0, i32 7
  %69 = load ptr, ptr %68, align 8, !tbaa !20
  %70 = icmp eq ptr %69, null
  br i1 %70, label %71, label %86

71:                                               ; preds = %66
  %72 = load i32, ptr %3, align 4, !tbaa !15
  %73 = add nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = mul i64 4, %74
  %76 = trunc i64 %75 to i32
  %77 = zext i32 %76 to i64
  %78 = call ptr @malloc(i64 noundef %77) #4
  %79 = load ptr, ptr %2, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.MatrixFrame, ptr %79, i32 0, i32 7
  store ptr %78, ptr %80, align 8, !tbaa !20
  %81 = icmp eq ptr %78, null
  br i1 %81, label %82, label %85

82:                                               ; preds = %71
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.MatrixFrame, ptr %83, i32 0, i32 9
  store i32 5, ptr %84, align 4, !tbaa !17
  br label %85

85:                                               ; preds = %82, %71
  br label %86

86:                                               ; preds = %85, %66
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.MatrixFrame, ptr %87, i32 0, i32 18
  %89 = load ptr, ptr %88, align 8, !tbaa !21
  %90 = icmp eq ptr %89, null
  br i1 %90, label %91, label %106

91:                                               ; preds = %86
  %92 = load i32, ptr %3, align 4, !tbaa !15
  %93 = add nsw i32 %92, 1
  %94 = sext i32 %93 to i64
  %95 = mul i64 8, %94
  %96 = trunc i64 %95 to i32
  %97 = zext i32 %96 to i64
  %98 = call ptr @malloc(i64 noundef %97) #4
  %99 = load ptr, ptr %2, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.MatrixFrame, ptr %99, i32 0, i32 18
  store ptr %98, ptr %100, align 8, !tbaa !21
  %101 = icmp eq ptr %98, null
  br i1 %101, label %102, label %105

102:                                              ; preds = %91
  %103 = load ptr, ptr %2, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.MatrixFrame, ptr %103, i32 0, i32 9
  store i32 5, ptr %104, align 4, !tbaa !17
  br label %105

105:                                              ; preds = %102, %91
  br label %106

106:                                              ; preds = %105, %86
  %107 = load ptr, ptr %2, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.MatrixFrame, ptr %107, i32 0, i32 9
  %109 = load i32, ptr %108, align 4, !tbaa !17
  %110 = icmp ne i32 %109, 5
  br i1 %110, label %111, label %114

111:                                              ; preds = %106
  %112 = load ptr, ptr %2, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.MatrixFrame, ptr %112, i32 0, i32 19
  store i32 1, ptr %113, align 8, !tbaa !22
  br label %114

114:                                              ; preds = %111, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

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

; Function Attrs: allocsize(0)
declare ptr @malloc(i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { allocsize(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 #3 = { nounwind }
attributes #4 = { allocsize(0) }

!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, !12, i64 228}
!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 = !{!12, !12, i64 0}
!16 = !{!10, !6, i64 144}
!17 = !{!10, !12, i64 52}
!18 = !{!10, !6, i64 152}
!19 = !{!10, !6, i64 160}
!20 = !{!10, !6, i64 40}
!21 = !{!10, !6, i64 112}
!22 = !{!10, !12, i64 120}


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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) uwtable
define dso_local void @spcCreateInternalVectors(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 228
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 144
  %5 = load ptr, ptr %4, align 8, !tbaa !14
  %6 = icmp eq ptr %5, null
  br i1 %6, label %7, label %15

7:                                                ; preds = %1
  %8 = shl i32 %3, 2
  %9 = add i32 %8, 4
  %10 = zext i32 %9 to i64
  %11 = tail call ptr @malloc(i64 noundef %10) #2
  store ptr %11, ptr %4, align 8, !tbaa !14
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %15

13:                                               ; preds = %7
  %14 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 5, ptr %14, align 4, !tbaa !15
  br label %15

15:                                               ; preds = %7, %13, %1
  %16 = getelementptr inbounds i8, ptr %0, i64 152
  %17 = load ptr, ptr %16, align 8, !tbaa !16
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %27

19:                                               ; preds = %15
  %20 = shl i32 %3, 2
  %21 = add i32 %20, 4
  %22 = zext i32 %21 to i64
  %23 = tail call ptr @malloc(i64 noundef %22) #2
  store ptr %23, ptr %16, align 8, !tbaa !16
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %27

25:                                               ; preds = %19
  %26 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 5, ptr %26, align 4, !tbaa !15
  br label %27

27:                                               ; preds = %19, %25, %15
  %28 = getelementptr inbounds i8, ptr %0, i64 160
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %39

31:                                               ; preds = %27
  %32 = shl i32 %3, 3
  %33 = add i32 %32, 16
  %34 = zext i32 %33 to i64
  %35 = tail call ptr @malloc(i64 noundef %34) #2
  store ptr %35, ptr %28, align 8, !tbaa !17
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %39

37:                                               ; preds = %31
  %38 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 5, ptr %38, align 4, !tbaa !15
  br label %39

39:                                               ; preds = %31, %37, %27
  %40 = getelementptr inbounds i8, ptr %0, i64 40
  %41 = load ptr, ptr %40, align 8, !tbaa !18
  %42 = icmp eq ptr %41, null
  br i1 %42, label %43, label %51

43:                                               ; preds = %39
  %44 = shl i32 %3, 2
  %45 = add i32 %44, 4
  %46 = zext i32 %45 to i64
  %47 = tail call ptr @malloc(i64 noundef %46) #2
  store ptr %47, ptr %40, align 8, !tbaa !18
  %48 = icmp eq ptr %47, null
  br i1 %48, label %49, label %51

49:                                               ; preds = %43
  %50 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 5, ptr %50, align 4, !tbaa !15
  br label %51

51:                                               ; preds = %43, %49, %39
  %52 = getelementptr inbounds i8, ptr %0, i64 112
  %53 = load ptr, ptr %52, align 8, !tbaa !19
  %54 = icmp eq ptr %53, null
  br i1 %54, label %55, label %63

55:                                               ; preds = %51
  %56 = shl i32 %3, 3
  %57 = add i32 %56, 8
  %58 = zext i32 %57 to i64
  %59 = tail call ptr @malloc(i64 noundef %58) #2
  store ptr %59, ptr %52, align 8, !tbaa !19
  %60 = icmp eq ptr %59, null
  br i1 %60, label %61, label %63

61:                                               ; preds = %55
  %62 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 5, ptr %62, align 4, !tbaa !15
  br label %63

63:                                               ; preds = %55, %61, %51
  %64 = getelementptr inbounds i8, ptr %0, i64 52
  %65 = load i32, ptr %64, align 4, !tbaa !15
  %.not = icmp eq i32 %65, 5
  br i1 %.not, label %68, label %66

66:                                               ; preds = %63
  %67 = getelementptr inbounds i8, ptr %0, i64 120
  store i32 1, ptr %67, align 8, !tbaa !20
  br label %68

68:                                               ; preds = %66, %63
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { allocsize(0) }

!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, !10, i64 228}
!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 = !{!6, !11, i64 144}
!15 = !{!6, !10, i64 52}
!16 = !{!6, !11, i64 152}
!17 = !{!6, !11, i64 160}
!18 = !{!6, !11, i64 40}
!19 = !{!6, !11, i64 112}
!20 = !{!6, !10, i64 120}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass