; LLVM IR from Slingshot-Physics/slingshot-community :: common/math/src/heap_matrix.ll (Z20ProjectedGaussSeidelRK10HeapMatrixS1_S1_RS_jf)

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

%class.HeapMatrix = type { i32, i32, i32, i32, i32, [12 x i8], ptr, [8 x i8] }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40), i32 noundef, i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40), i32 noundef, i32 noundef) #1 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK10HeapMatrix21innerProductRowVecSseEjRKS_(ptr noundef nonnull align 16 dereferenceable(40), i32 noundef, ptr noundef nonnull align 16 dereferenceable(40)) #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(40) ptr @_ZN10HeapMatrixaSERKS_(ptr noundef nonnull align 16 dereferenceable(40), ptr noundef nonnull align 16 dereferenceable(40)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 16 dereferenceable(40) ptr @_ZN10HeapMatrixpLEf(ptr noundef nonnull align 16 dereferenceable(40), float noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z20ProjectedGaussSeidelRK10HeapMatrixS1_S1_RS_jf(ptr noundef nonnull align 16 dereferenceable(40) %0, ptr noundef nonnull align 16 dereferenceable(40) %1, ptr noundef nonnull align 16 dereferenceable(40) %2, ptr noundef nonnull align 16 dereferenceable(40) %3, i32 noundef %4, float noundef %5) #1 personality ptr @__gxx_personality_v0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca float, align 4
  %13 = alloca %class.HeapMatrix, align 16
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca float, align 4
  %20 = alloca ptr, align 8
  %21 = alloca float, align 4
  %22 = alloca ptr, align 8
  %23 = alloca float, align 4
  %24 = alloca float, align 4
  %25 = alloca float, align 4
  %26 = alloca i32, align 4
  %27 = alloca float, align 4
  %28 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  store float %5, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 48, ptr %13) #6
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = getelementptr inbounds %class.HeapMatrix, ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 16, !tbaa !13
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = getelementptr inbounds %class.HeapMatrix, ptr %32, i32 0, i32 1
  %34 = load i32, ptr %33, align 4, !tbaa !15
  call void @_ZN10HeapMatrixC1Ejj(ptr noundef nonnull align 16 dereferenceable(40) %13, i32 noundef %31, i32 noundef %34)
  %35 = invoke noundef nonnull align 16 dereferenceable(40) ptr @_ZN10HeapMatrixpLEf(ptr noundef nonnull align 16 dereferenceable(40) %13, float noundef 0x47EFFFFFE0000000)
          to label %36 unwind label %49

36:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !9
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %37

37:                                               ; preds = %162, %36
  %38 = load i32, ptr %16, align 4, !tbaa !9
  %39 = load i32, ptr %11, align 4, !tbaa !9
  %40 = icmp ult i32 %38, %39
  br i1 %40, label %41, label %165

41:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %93, %41
  %43 = load i32, ptr %17, align 4, !tbaa !9
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = getelementptr inbounds %class.HeapMatrix, ptr %44, i32 0, i32 0
  %46 = load i32, ptr %45, align 16, !tbaa !13
  %47 = icmp ult i32 %43, %46
  br i1 %47, label %53, label %48

48:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %120

49:                                               ; preds = %6
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %14, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %15, align 4
  br label %167

53:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = load i32, ptr %17, align 4, !tbaa !9
  %56 = invoke noundef float @_ZNK10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %54, i32 noundef %55, i32 noundef 0)
          to label %57 unwind label %96

57:                                               ; preds = %53
  store float %56, ptr %19, align 4, !tbaa !11
  store ptr %19, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = load i32, ptr %17, align 4, !tbaa !9
  %60 = invoke noundef float @_ZNK10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %58, i32 noundef %59, i32 noundef 1)
          to label %61 unwind label %100

61:                                               ; preds = %57
  store float %60, ptr %21, align 4, !tbaa !11
  store ptr %21, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = load i32, ptr %17, align 4, !tbaa !9
  %64 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %62, i32 noundef %63, i32 noundef 0)
          to label %65 unwind label %104

65:                                               ; preds = %61
  store ptr %64, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = load i32, ptr %17, align 4, !tbaa !9
  %68 = invoke noundef float @_ZNK10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %66, i32 noundef %67, i32 noundef 0)
          to label %69 unwind label %108

69:                                               ; preds = %65
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load i32, ptr %17, align 4, !tbaa !9
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  %73 = call noundef float @_ZNK10HeapMatrix21innerProductRowVecSseEjRKS_(ptr noundef nonnull align 16 dereferenceable(40) %70, i32 noundef %71, ptr noundef nonnull align 16 dereferenceable(40) %72)
  %74 = fsub float %68, %73
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = load i32, ptr %17, align 4, !tbaa !9
  %77 = load i32, ptr %17, align 4, !tbaa !9
  %78 = invoke noundef float @_ZNK10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %75, i32 noundef %76, i32 noundef %77)
          to label %79 unwind label %108

79:                                               ; preds = %69
  %80 = fdiv float %74, %78
  store float %80, ptr %23, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  %81 = load ptr, ptr %22, align 8, !tbaa !5
  %82 = load float, ptr %81, align 4, !tbaa !11
  %83 = load float, ptr %23, align 4, !tbaa !11
  %84 = fadd float %82, %83
  store float %84, ptr %24, align 4, !tbaa !11
  %85 = load ptr, ptr %18, align 8, !tbaa !5
  %86 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %24, ptr noundef nonnull align 4 dereferenceable(4) %85)
          to label %87 unwind label %112

87:                                               ; preds = %79
  %88 = load ptr, ptr %20, align 8, !tbaa !5
  %89 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %86, ptr noundef nonnull align 4 dereferenceable(4) %88)
          to label %90 unwind label %112

90:                                               ; preds = %87
  %91 = load float, ptr %89, align 4, !tbaa !11
  %92 = load ptr, ptr %22, align 8, !tbaa !5
  store float %91, ptr %92, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %93

93:                                               ; preds = %90
  %94 = load i32, ptr %17, align 4, !tbaa !9
  %95 = add i32 %94, 1
  store i32 %95, ptr %17, align 4, !tbaa !9
  br label %42, !llvm.loop !16

96:                                               ; preds = %53
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %14, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %15, align 4
  br label %119

100:                                              ; preds = %57
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %14, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %15, align 4
  br label %118

104:                                              ; preds = %61
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %14, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %15, align 4
  br label %117

108:                                              ; preds = %69, %65
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %14, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %15, align 4
  br label %116

112:                                              ; preds = %87, %79
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %14, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %116

116:                                              ; preds = %112, %108
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %117

117:                                              ; preds = %116, %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %118

118:                                              ; preds = %117, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %119

119:                                              ; preds = %118, %96
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %166

120:                                              ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  store float 0.000000e+00, ptr %25, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #6
  store i32 0, ptr %26, align 4, !tbaa !9
  br label %121

121:                                              ; preds = %143, %120
  %122 = load i32, ptr %26, align 4, !tbaa !9
  %123 = load ptr, ptr %10, align 8, !tbaa !5
  %124 = getelementptr inbounds %class.HeapMatrix, ptr %123, i32 0, i32 0
  %125 = load i32, ptr %124, align 16, !tbaa !13
  %126 = icmp ult i32 %122, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  br label %150

128:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #6
  %129 = load i32, ptr %26, align 4, !tbaa !9
  %130 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %13, i32 noundef %129, i32 noundef 0)
          to label %131 unwind label %146

131:                                              ; preds = %128
  %132 = load float, ptr %130, align 4, !tbaa !11
  %133 = load ptr, ptr %10, align 8, !tbaa !5
  %134 = load i32, ptr %26, align 4, !tbaa !9
  %135 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %133, i32 noundef %134, i32 noundef 0)
          to label %136 unwind label %146

136:                                              ; preds = %131
  %137 = load float, ptr %135, align 4, !tbaa !11
  %138 = fsub float %132, %137
  store float %138, ptr %27, align 4, !tbaa !11
  %139 = load float, ptr %27, align 4, !tbaa !11
  %140 = load float, ptr %27, align 4, !tbaa !11
  %141 = load float, ptr %25, align 4, !tbaa !11
  %142 = call float @llvm.fmuladd.f32(float %139, float %140, float %141)
  store float %142, ptr %25, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #6
  br label %143

143:                                              ; preds = %136
  %144 = load i32, ptr %26, align 4, !tbaa !9
  %145 = add i32 %144, 1
  store i32 %145, ptr %26, align 4, !tbaa !9
  br label %121, !llvm.loop !18

146:                                              ; preds = %131, %128
  %147 = landingpad { ptr, i32 }
          cleanup
  %148 = extractvalue { ptr, i32 } %147, 0
  store ptr %148, ptr %14, align 8
  %149 = extractvalue { ptr, i32 } %147, 1
  store i32 %149, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %166

150:                                              ; preds = %127
  %151 = load float, ptr %25, align 4, !tbaa !11
  %152 = call float @sqrtf(float noundef %151) #6
  %153 = load float, ptr %12, align 4, !tbaa !11
  %154 = fcmp olt float %152, %153
  br i1 %154, label %155, label %156

155:                                              ; preds = %150
  store i32 2, ptr %28, align 4
  br label %159

156:                                              ; preds = %150
  %157 = load ptr, ptr %10, align 8, !tbaa !5
  %158 = call noundef nonnull align 16 dereferenceable(40) ptr @_ZN10HeapMatrixaSERKS_(ptr noundef nonnull align 16 dereferenceable(40) %13, ptr noundef nonnull align 16 dereferenceable(40) %157)
  store i32 0, ptr %28, align 4
  br label %159

159:                                              ; preds = %156, %155
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  %160 = load i32, ptr %28, align 4
  switch i32 %160, label %173 [
    i32 0, label %161
    i32 2, label %165
  ]

161:                                              ; preds = %159
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %16, align 4, !tbaa !9
  %164 = add i32 %163, 1
  store i32 %164, ptr %16, align 4, !tbaa !9
  br label %37, !llvm.loop !19

165:                                              ; preds = %159, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @_ZN10HeapMatrixD1Ev(ptr noundef nonnull align 16 dereferenceable(40) %13) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %13) #6
  ret void

166:                                              ; preds = %146, %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %167

167:                                              ; preds = %166, %49
  call void @_ZN10HeapMatrixD1Ev(ptr noundef nonnull align 16 dereferenceable(40) %13) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %13) #6
  br label %168

168:                                              ; preds = %167
  %169 = load ptr, ptr %14, align 8
  %170 = load i32, ptr %15, align 4
  %171 = insertvalue { ptr, i32 } poison, ptr %169, 0
  %172 = insertvalue { ptr, i32 } %171, i32 %170, 1
  resume { ptr, i32 } %172

173:                                              ; preds = %159
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: nounwind
declare float @sqrtf(float noundef) #5

declare void @_ZN10HeapMatrixC1Ejj(ptr, i32, i32)

declare void @_ZN10HeapMatrixD1Ev(ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress 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 #4 = { inlinehint mustprogress 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 #5 = { 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 #6 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTS10HeapMatrix", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !6, i64 32}
!15 = !{!14, !10, i64 4}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}


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

%class.HeapMatrix = type { i32, i32, i32, i32, i32, [12 x i8], ptr, [8 x i8] }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK10HeapMatrix21innerProductRowVecSseEjRKS_(ptr noundef nonnull align 16 dereferenceable(40), i32 noundef, ptr noundef nonnull align 16 dereferenceable(40)) local_unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(40) ptr @_ZN10HeapMatrixaSERKS_(ptr noundef nonnull align 16 dereferenceable(40), ptr noundef nonnull align 16 dereferenceable(40)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 16 dereferenceable(40) ptr @_ZN10HeapMatrixpLEf(ptr noundef nonnull align 16 dereferenceable(40), float noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z20ProjectedGaussSeidelRK10HeapMatrixS1_S1_RS_jf(ptr noundef nonnull align 16 dereferenceable(40) %0, ptr noundef nonnull align 16 dereferenceable(40) %1, ptr noundef nonnull align 16 dereferenceable(40) %2, ptr noundef nonnull align 16 dereferenceable(40) %3, i32 noundef %4, float noundef %5) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %7 = alloca %class.HeapMatrix, align 16
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %7) #6
  %11 = load i32, ptr %3, align 16, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %3, i64 4
  %13 = load i32, ptr %12, align 4, !tbaa !11
  call void @_ZN10HeapMatrixC1Ejj(ptr noundef nonnull align 16 dereferenceable(40) %7, i32 noundef %11, i32 noundef %13)
  %14 = invoke noundef nonnull align 16 dereferenceable(40) ptr @_ZN10HeapMatrixpLEf(ptr noundef nonnull align 16 dereferenceable(40) %7, float noundef 0x47EFFFFFE0000000)
          to label %.preheader59 unwind label %16

.preheader59:                                     ; preds = %6
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %._crit_edge66, label %.preheader58

.preheader58:                                     ; preds = %.preheader59, %64
  %.04965 = phi i32 [ %66, %64 ], [ 0, %.preheader59 ]
  %15 = load i32, ptr %3, align 16, !tbaa !5
  %.not68 = icmp eq i32 %15, 0
  br i1 %.not68, label %._crit_edge, label %.lr.ph

.preheader:                                       ; preds = %28
  %.not69 = icmp eq i32 %37, 0
  br i1 %.not69, label %._crit_edge, label %.lr.ph64

16:                                               ; preds = %6
  %17 = landingpad { ptr, i32 }
          cleanup
  br label %67

.lr.ph:                                           ; preds = %.preheader58, %28
  %.05061 = phi i32 [ %36, %28 ], [ 0, %.preheader58 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  %18 = invoke noundef float @_ZNK10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %2, i32 noundef %.05061, i32 noundef 0)
          to label %19 unwind label %39

19:                                               ; preds = %.lr.ph
  store float %18, ptr %8, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  %20 = invoke noundef float @_ZNK10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %2, i32 noundef %.05061, i32 noundef 1)
          to label %21 unwind label %41

21:                                               ; preds = %19
  store float %20, ptr %9, align 4, !tbaa !12
  %22 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %3, i32 noundef %.05061, i32 noundef 0)
          to label %23 unwind label %43

23:                                               ; preds = %21
  %24 = invoke noundef float @_ZNK10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %1, i32 noundef %.05061, i32 noundef 0)
          to label %25 unwind label %45

25:                                               ; preds = %23
  %26 = call noundef float @_ZNK10HeapMatrix21innerProductRowVecSseEjRKS_(ptr noundef nonnull align 16 dereferenceable(40) %0, i32 noundef %.05061, ptr noundef nonnull align 16 dereferenceable(40) %3)
  %27 = invoke noundef float @_ZNK10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %0, i32 noundef %.05061, i32 noundef %.05061)
          to label %28 unwind label %45

28:                                               ; preds = %25
  %29 = fsub float %24, %26
  %30 = fdiv float %29, %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #6
  %31 = load float, ptr %22, align 4, !tbaa !12
  %32 = fadd float %30, %31
  store float %32, ptr %10, align 4, !tbaa !12
  %33 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %33, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %35 = load float, ptr %34, align 4, !tbaa !12
  store float %35, ptr %22, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  %36 = add nuw i32 %.05061, 1
  %37 = load i32, ptr %3, align 16, !tbaa !5
  %38 = icmp ult i32 %36, %37
  br i1 %38, label %.lr.ph, label %.preheader, !llvm.loop !14

39:                                               ; preds = %.lr.ph
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %67

41:                                               ; preds = %19
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %48

43:                                               ; preds = %21
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %47

45:                                               ; preds = %25, %23
  %46 = landingpad { ptr, i32 }
          cleanup
  br label %47

47:                                               ; preds = %45, %43
  %.pn = phi { ptr, i32 } [ %46, %45 ], [ %44, %43 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  br label %48

48:                                               ; preds = %47, %41
  %.pn.pn = phi { ptr, i32 } [ %.pn, %47 ], [ %42, %41 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %67

._crit_edge:                                      ; preds = %55, %.preheader58, %.preheader
  %.043.lcssa = phi float [ 0.000000e+00, %.preheader ], [ 0.000000e+00, %.preheader58 ], [ %58, %55 ]
  %49 = call float @sqrtf(float noundef %.043.lcssa) #6
  %50 = fcmp olt float %49, %5
  br i1 %50, label %._crit_edge66, label %64

.lr.ph64:                                         ; preds = %.preheader, %55
  %.04263 = phi i32 [ %59, %55 ], [ 0, %.preheader ]
  %.04362 = phi float [ %58, %55 ], [ 0.000000e+00, %.preheader ]
  %51 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %7, i32 noundef %.04263, i32 noundef 0)
          to label %52 unwind label %62

52:                                               ; preds = %.lr.ph64
  %53 = load float, ptr %51, align 4, !tbaa !12
  %54 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN10HeapMatrixclEjj(ptr noundef nonnull align 16 dereferenceable(40) %3, i32 noundef %.04263, i32 noundef 0)
          to label %55 unwind label %62

55:                                               ; preds = %52
  %56 = load float, ptr %54, align 4, !tbaa !12
  %57 = fsub float %53, %56
  %58 = call float @llvm.fmuladd.f32(float %57, float %57, float %.04362)
  %59 = add nuw i32 %.04263, 1
  %60 = load i32, ptr %3, align 16, !tbaa !5
  %61 = icmp ult i32 %59, %60
  br i1 %61, label %.lr.ph64, label %._crit_edge, !llvm.loop !16

62:                                               ; preds = %52, %.lr.ph64
  %63 = landingpad { ptr, i32 }
          cleanup
  br label %67

64:                                               ; preds = %._crit_edge
  %65 = call noundef nonnull align 16 dereferenceable(40) ptr @_ZN10HeapMatrixaSERKS_(ptr noundef nonnull align 16 dereferenceable(40) %7, ptr noundef nonnull align 16 dereferenceable(40) %3)
  %66 = add nuw i32 %.04965, 1
  %exitcond.not = icmp eq i32 %66, %4
  br i1 %exitcond.not, label %._crit_edge66, label %.preheader58, !llvm.loop !17

._crit_edge66:                                    ; preds = %64, %._crit_edge, %.preheader59
  call void @_ZN10HeapMatrixD1Ev(ptr noundef nonnull align 16 dereferenceable(40) %7) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #6
  ret void

67:                                               ; preds = %62, %48, %39, %16
  %.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %17, %16 ], [ %63, %62 ], [ %.pn.pn, %48 ], [ %40, %39 ]
  call void @_ZN10HeapMatrixD1Ev(ptr noundef nonnull align 16 dereferenceable(40) %7) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #6
  resume { ptr, i32 } %.pn.pn.pn.pn.pn
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @sqrtf(float noundef) local_unnamed_addr #5

declare void @_ZN10HeapMatrixC1Ejj(ptr, i32, i32) local_unnamed_addr

declare void @_ZN10HeapMatrixD1Ev(ptr) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress 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 #4 = { inlinehint mustprogress 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 #5 = { mustprogress nofree nounwind willreturn memory(write) "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 #6 = { 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, !7, i64 0}
!6 = !{!"_ZTS10HeapMatrix", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 32}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!13, !13, i64 0}
!13 = !{!"float", !8, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass