; LLVM IR from beagleboard/librobotcontrol :: library/src/math (matrix)

; 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.rc_matrix_t = type { i32, i32, ptr, i32 }

@stderr = external global ptr, align 8
@.str.52 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [62 x i8], align 1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @rc_matrix_free(ptr noundef) #4

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @rc_matrix_duplicate(ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local double @rc_matrix_determinant(ptr noundef byval(%struct.rc_matrix_t) align 8 %0) #4 {
  %2 = alloca double, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca %struct.rc_matrix_t, align 8
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #6
  call void @llvm.memset.p0.i64(ptr align 8 %8, i8 0, i64 24, i1 false)
  %10 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 3
  %11 = load i32, ptr %10, align 8, !tbaa !5
  %12 = icmp ne i32 %11, 1
  %13 = xor i1 %12, true
  %14 = xor i1 %13, true
  %15 = zext i1 %14 to i32
  %16 = sext i32 %15 to i64
  %17 = call i64 @llvm.expect.i64(i64 %16, i64 0)
  %18 = icmp ne i64 %17, 0
  br i1 %18, label %19, label %22

19:                                               ; preds = %1
  %20 = load ptr, ptr @stderr, align 8, !tbaa !11
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef @.str.52) #6
  store double -1.000000e+00, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %194

22:                                               ; preds = %1
  %23 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 0
  %24 = load i32, ptr %23, align 8, !tbaa !12
  %25 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 1
  %26 = load i32, ptr %25, align 4, !tbaa !13
  %27 = icmp ne i32 %24, %26
  %28 = xor i1 %27, true
  %29 = xor i1 %28, true
  %30 = zext i1 %29 to i32
  %31 = sext i32 %30 to i64
  %32 = call i64 @llvm.expect.i64(i64 %31, i64 0)
  %33 = icmp ne i64 %32, 0
  br i1 %33, label %34, label %37

34:                                               ; preds = %22
  %35 = load ptr, ptr @stderr, align 8, !tbaa !11
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef @.str.53) #6
  store double -1.000000e+00, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %194

37:                                               ; preds = %22
  %38 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 0
  %39 = load i32, ptr %38, align 8, !tbaa !12
  %40 = icmp eq i32 %39, 1
  br i1 %40, label %41, label %48

41:                                               ; preds = %37
  %42 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 2
  %43 = load ptr, ptr %42, align 8, !tbaa !14
  %44 = getelementptr inbounds ptr, ptr %43, i64 0
  %45 = load ptr, ptr %44, align 8, !tbaa !11
  %46 = getelementptr inbounds double, ptr %45, i64 0
  %47 = load double, ptr %46, align 8, !tbaa !15
  store double %47, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %194

48:                                               ; preds = %37
  %49 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 0
  %50 = load i32, ptr %49, align 8, !tbaa !12
  %51 = icmp eq i32 %50, 2
  br i1 %51, label %52, label %80

52:                                               ; preds = %48
  %53 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 2
  %54 = load ptr, ptr %53, align 8, !tbaa !14
  %55 = getelementptr inbounds ptr, ptr %54, i64 0
  %56 = load ptr, ptr %55, align 8, !tbaa !11
  %57 = getelementptr inbounds double, ptr %56, i64 0
  %58 = load double, ptr %57, align 8, !tbaa !15
  %59 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 2
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = getelementptr inbounds ptr, ptr %60, i64 1
  %62 = load ptr, ptr %61, align 8, !tbaa !11
  %63 = getelementptr inbounds double, ptr %62, i64 1
  %64 = load double, ptr %63, align 8, !tbaa !15
  %65 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 2
  %66 = load ptr, ptr %65, align 8, !tbaa !14
  %67 = getelementptr inbounds ptr, ptr %66, i64 0
  %68 = load ptr, ptr %67, align 8, !tbaa !11
  %69 = getelementptr inbounds double, ptr %68, i64 1
  %70 = load double, ptr %69, align 8, !tbaa !15
  %71 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 2
  %72 = load ptr, ptr %71, align 8, !tbaa !14
  %73 = getelementptr inbounds ptr, ptr %72, i64 1
  %74 = load ptr, ptr %73, align 8, !tbaa !11
  %75 = getelementptr inbounds double, ptr %74, i64 0
  %76 = load double, ptr %75, align 8, !tbaa !15
  %77 = fmul double %70, %76
  %78 = fneg double %77
  %79 = call double @llvm.fmuladd.f64(double %58, double %64, double %78)
  store double %79, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %194

80:                                               ; preds = %48
  %81 = call i32 @rc_matrix_duplicate(ptr noundef byval(%struct.rc_matrix_t) align 8 %0, ptr noundef %8)
  %82 = icmp ne i32 %81, 0
  %83 = xor i1 %82, true
  %84 = xor i1 %83, true
  %85 = zext i1 %84 to i32
  %86 = sext i32 %85 to i64
  %87 = call i64 @llvm.expect.i64(i64 %86, i64 0)
  %88 = icmp ne i64 %87, 0
  br i1 %88, label %89, label %92

89:                                               ; preds = %80
  %90 = load ptr, ptr @stderr, align 8, !tbaa !11
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %90, ptr noundef @.str.54) #6
  store double -1.000000e+00, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %194

92:                                               ; preds = %80
  store i32 0, ptr %3, align 4, !tbaa !17
  br label %93

93:                                               ; preds = %166, %92
  %94 = load i32, ptr %3, align 4, !tbaa !17
  %95 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 0
  %96 = load i32, ptr %95, align 8, !tbaa !12
  %97 = sub nsw i32 %96, 1
  %98 = icmp slt i32 %94, %97
  br i1 %98, label %99, label %169

99:                                               ; preds = %93
  %100 = load i32, ptr %3, align 4, !tbaa !17
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %4, align 4, !tbaa !17
  br label %102

102:                                              ; preds = %162, %99
  %103 = load i32, ptr %4, align 4, !tbaa !17
  %104 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 0
  %105 = load i32, ptr %104, align 8, !tbaa !12
  %106 = icmp slt i32 %103, %105
  br i1 %106, label %107, label %165

107:                                              ; preds = %102
  %108 = getelementptr inbounds %struct.rc_matrix_t, ptr %8, i32 0, i32 2
  %109 = load ptr, ptr %108, align 8, !tbaa !14
  %110 = load i32, ptr %4, align 4, !tbaa !17
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds ptr, ptr %109, i64 %111
  %113 = load ptr, ptr %112, align 8, !tbaa !11
  %114 = load i32, ptr %3, align 4, !tbaa !17
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds double, ptr %113, i64 %115
  %117 = load double, ptr %116, align 8, !tbaa !15
  %118 = getelementptr inbounds %struct.rc_matrix_t, ptr %8, i32 0, i32 2
  %119 = load ptr, ptr %118, align 8, !tbaa !14
  %120 = load i32, ptr %3, align 4, !tbaa !17
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds ptr, ptr %119, i64 %121
  %123 = load ptr, ptr %122, align 8, !tbaa !11
  %124 = load i32, ptr %3, align 4, !tbaa !17
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds double, ptr %123, i64 %125
  %127 = load double, ptr %126, align 8, !tbaa !15
  %128 = fdiv double %117, %127
  store double %128, ptr %6, align 8, !tbaa !15
  store i32 0, ptr %5, align 4, !tbaa !17
  br label %129

129:                                              ; preds = %158, %107
  %130 = load i32, ptr %5, align 4, !tbaa !17
  %131 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 0
  %132 = load i32, ptr %131, align 8, !tbaa !12
  %133 = icmp slt i32 %130, %132
  br i1 %133, label %134, label %161

134:                                              ; preds = %129
  %135 = load double, ptr %6, align 8, !tbaa !15
  %136 = getelementptr inbounds %struct.rc_matrix_t, ptr %8, i32 0, i32 2
  %137 = load ptr, ptr %136, align 8, !tbaa !14
  %138 = load i32, ptr %3, align 4, !tbaa !17
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds ptr, ptr %137, i64 %139
  %141 = load ptr, ptr %140, align 8, !tbaa !11
  %142 = load i32, ptr %5, align 4, !tbaa !17
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds double, ptr %141, i64 %143
  %145 = load double, ptr %144, align 8, !tbaa !15
  %146 = getelementptr inbounds %struct.rc_matrix_t, ptr %8, i32 0, i32 2
  %147 = load ptr, ptr %146, align 8, !tbaa !14
  %148 = load i32, ptr %4, align 4, !tbaa !17
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds ptr, ptr %147, i64 %149
  %151 = load ptr, ptr %150, align 8, !tbaa !11
  %152 = load i32, ptr %5, align 4, !tbaa !17
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds double, ptr %151, i64 %153
  %155 = load double, ptr %154, align 8, !tbaa !15
  %156 = fneg double %135
  %157 = call double @llvm.fmuladd.f64(double %156, double %145, double %155)
  store double %157, ptr %154, align 8, !tbaa !15
  br label %158

158:                                              ; preds = %134
  %159 = load i32, ptr %5, align 4, !tbaa !17
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %5, align 4, !tbaa !17
  br label %129, !llvm.loop !18

161:                                              ; preds = %129
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %4, align 4, !tbaa !17
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %4, align 4, !tbaa !17
  br label %102, !llvm.loop !20

165:                                              ; preds = %102
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %3, align 4, !tbaa !17
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %3, align 4, !tbaa !17
  br label %93, !llvm.loop !21

169:                                              ; preds = %93
  store double 1.000000e+00, ptr %7, align 8, !tbaa !15
  store i32 0, ptr %3, align 4, !tbaa !17
  br label %170

170:                                              ; preds = %188, %169
  %171 = load i32, ptr %3, align 4, !tbaa !17
  %172 = getelementptr inbounds %struct.rc_matrix_t, ptr %0, i32 0, i32 0
  %173 = load i32, ptr %172, align 8, !tbaa !12
  %174 = icmp slt i32 %171, %173
  br i1 %174, label %175, label %191

175:                                              ; preds = %170
  %176 = getelementptr inbounds %struct.rc_matrix_t, ptr %8, i32 0, i32 2
  %177 = load ptr, ptr %176, align 8, !tbaa !14
  %178 = load i32, ptr %3, align 4, !tbaa !17
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds ptr, ptr %177, i64 %179
  %181 = load ptr, ptr %180, align 8, !tbaa !11
  %182 = load i32, ptr %3, align 4, !tbaa !17
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds double, ptr %181, i64 %183
  %185 = load double, ptr %184, align 8, !tbaa !15
  %186 = load double, ptr %7, align 8, !tbaa !15
  %187 = fmul double %186, %185
  store double %187, ptr %7, align 8, !tbaa !15
  br label %188

188:                                              ; preds = %175
  %189 = load i32, ptr %3, align 4, !tbaa !17
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %3, align 4, !tbaa !17
  br label %170, !llvm.loop !22

191:                                              ; preds = %170
  %192 = call i32 @rc_matrix_free(ptr noundef %8)
  %193 = load double, ptr %7, align 8, !tbaa !15
  store double %193, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %194

194:                                              ; preds = %191, %89, %52, %41, %34, %19
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  %195 = load double, ptr %2, align 8
  ret double %195
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(none) }
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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 16}
!6 = !{!"rc_matrix_t", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !7, i64 4}
!14 = !{!6, !10, i64 8}
!15 = !{!16, !16, i64 0}
!16 = !{!"double", !8, i64 0}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !19}


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

%struct.rc_matrix_t = type { i32, i32, ptr, i32 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.52 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [62 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @rc_matrix_free(ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @rc_matrix_duplicate(ptr noundef byval(%struct.rc_matrix_t) align 8, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local double @rc_matrix_determinant(ptr noundef byval(%struct.rc_matrix_t) align 8 %0) local_unnamed_addr #3 {
  %2 = alloca %struct.rc_matrix_t, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %2, i8 0, i64 24, i1 false)
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %.not = icmp eq i32 %4, 1
  br i1 %.not, label %8, label %5, !prof !11

5:                                                ; preds = %1
  %6 = load ptr, ptr @stderr, align 8, !tbaa !12
  %7 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str.52) #7
  br label %112

8:                                                ; preds = %1
  %9 = load i32, ptr %0, align 8, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  %11 = load i32, ptr %10, align 4, !tbaa !14
  %.not27 = icmp eq i32 %9, %11
  br i1 %.not27, label %15, label %12, !prof !11

12:                                               ; preds = %8
  %13 = load ptr, ptr @stderr, align 8, !tbaa !12
  %14 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef nonnull @.str.53) #7
  br label %112

15:                                               ; preds = %8
  switch i32 %9, label %36 [
    i32 1, label %16
    i32 2, label %21
  ]

16:                                               ; preds = %15
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  %18 = load ptr, ptr %17, align 8, !tbaa !15
  %19 = load ptr, ptr %18, align 8, !tbaa !12
  %20 = load double, ptr %19, align 8, !tbaa !16
  br label %112

21:                                               ; preds = %15
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !15
  %24 = load ptr, ptr %23, align 8, !tbaa !12
  %25 = load double, ptr %24, align 8, !tbaa !16
  %26 = getelementptr inbounds i8, ptr %23, i64 8
  %27 = load ptr, ptr %26, align 8, !tbaa !12
  %28 = getelementptr inbounds i8, ptr %27, i64 8
  %29 = load double, ptr %28, align 8, !tbaa !16
  %30 = getelementptr inbounds i8, ptr %24, i64 8
  %31 = load double, ptr %30, align 8, !tbaa !16
  %32 = load double, ptr %27, align 8, !tbaa !16
  %33 = fneg double %31
  %34 = fmul double %32, %33
  %35 = tail call double @llvm.fmuladd.f64(double %25, double %29, double %34)
  br label %112

36:                                               ; preds = %15
  %37 = call i32 @rc_matrix_duplicate(ptr noundef nonnull byval(%struct.rc_matrix_t) align 8 %0, ptr noundef nonnull %2)
  %.not28 = icmp eq i32 %37, 0
  br i1 %.not28, label %.preheader29, label %78, !prof !11

.preheader29:                                     ; preds = %36
  %38 = load i32, ptr %0, align 8, !tbaa !13
  %39 = icmp sgt i32 %38, 1
  br i1 %39, label %.lr.ph.split.us.preheader, label %.preheader

.lr.ph.split.us.preheader:                        ; preds = %.preheader29
  %40 = add nsw i32 %38, -1
  %41 = getelementptr inbounds i8, ptr %2, i64 8
  %42 = load ptr, ptr %41, align 8
  %wide.trip.count51 = zext nneg i32 %40 to i64
  %wide.trip.count46 = zext nneg i32 %38 to i64
  %43 = shl nuw nsw i64 %wide.trip.count46, 3
  %min.iters.check = icmp ult i32 %38, 4
  %n.vec = and i64 %wide.trip.count46, 2147483644
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count46
  %xtraiter = and i64 %wide.trip.count46, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  %44 = add nsw i64 %wide.trip.count46, -1
  br label %.lr.ph33.us

.loopexit.us:                                     ; preds = %._crit_edge.us.us
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %exitcond52.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count51
  br i1 %exitcond52.not, label %.preheader, label %.lr.ph33.us, !llvm.loop !18

.lr.ph33.us:                                      ; preds = %.loopexit.us, %.lr.ph.split.us.preheader
  %indvars.iv48 = phi i64 [ 0, %.lr.ph.split.us.preheader ], [ %indvars.iv.next49, %.loopexit.us ]
  %indvars.iv41 = phi i64 [ 1, %.lr.ph.split.us.preheader ], [ %indvars.iv.next42, %.loopexit.us ]
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %45 = getelementptr inbounds ptr, ptr %42, i64 %indvars.iv48
  %46 = load ptr, ptr %45, align 8, !tbaa !12
  %47 = getelementptr inbounds double, ptr %46, i64 %indvars.iv48
  %scevgep58 = getelementptr i8, ptr %46, i64 %43
  br label %.lr.ph.us.us

.lr.ph.us.us:                                     ; preds = %._crit_edge.us.us, %.lr.ph33.us
  %indvars.iv43 = phi i64 [ %indvars.iv.next44, %._crit_edge.us.us ], [ %indvars.iv41, %.lr.ph33.us ]
  %48 = getelementptr inbounds ptr, ptr %42, i64 %indvars.iv43
  %49 = load ptr, ptr %48, align 8, !tbaa !12
  %50 = getelementptr inbounds double, ptr %49, i64 %indvars.iv48
  %51 = load double, ptr %50, align 8, !tbaa !16
  %52 = load double, ptr %47, align 8, !tbaa !16
  %53 = fneg double %51
  %54 = fdiv double %53, %52
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph.us.us
  %scevgep = getelementptr i8, ptr %49, i64 %43
  %bound0 = icmp ult ptr %49, %scevgep58
  %bound1 = icmp ult ptr %46, %scevgep
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %broadcast.splatinsert = insertelement <2 x double> poison, double %54, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %55 = getelementptr inbounds double, ptr %46, i64 %index
  %56 = getelementptr inbounds i8, ptr %55, i64 16
  %wide.load = load <2 x double>, ptr %55, align 8, !tbaa !16, !alias.scope !20
  %wide.load59 = load <2 x double>, ptr %56, align 8, !tbaa !16, !alias.scope !20
  %57 = getelementptr inbounds double, ptr %49, i64 %index
  %58 = getelementptr inbounds i8, ptr %57, i64 16
  %wide.load60 = load <2 x double>, ptr %57, align 8, !tbaa !16, !alias.scope !23, !noalias !20
  %wide.load61 = load <2 x double>, ptr %58, align 8, !tbaa !16, !alias.scope !23, !noalias !20
  %59 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat, <2 x double> %wide.load, <2 x double> %wide.load60)
  %60 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat, <2 x double> %wide.load59, <2 x double> %wide.load61)
  store <2 x double> %59, ptr %57, align 8, !tbaa !16, !alias.scope !23, !noalias !20
  store <2 x double> %60, ptr %58, align 8, !tbaa !16, !alias.scope !23, !noalias !20
  %index.next = add nuw i64 %index, 4
  %61 = icmp eq i64 %index.next, %n.vec
  br i1 %61, label %middle.block, label %vector.body, !llvm.loop !25

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge.us.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %.lr.ph.us.us
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph.us.us ], [ %n.vec, %middle.block ]
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader
  %62 = getelementptr inbounds double, ptr %46, i64 %indvars.iv.ph
  %63 = load double, ptr %62, align 8, !tbaa !16
  %64 = getelementptr inbounds double, ptr %49, i64 %indvars.iv.ph
  %65 = load double, ptr %64, align 8, !tbaa !16
  %66 = call double @llvm.fmuladd.f64(double %54, double %63, double %65)
  store double %66, ptr %64, align 8, !tbaa !16
  %indvars.iv.next.prol = or disjoint i64 %indvars.iv.ph, 1
  br label %scalar.ph.prol.loopexit

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %scalar.ph.preheader ], [ %indvars.iv.next.prol, %scalar.ph.prol ]
  %67 = icmp eq i64 %indvars.iv.ph, %44
  br i1 %67, label %._crit_edge.us.us, label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %scalar.ph ], [ %indvars.iv.unr, %scalar.ph.prol.loopexit ]
  %68 = getelementptr inbounds double, ptr %46, i64 %indvars.iv
  %69 = load double, ptr %68, align 8, !tbaa !16
  %70 = getelementptr inbounds double, ptr %49, i64 %indvars.iv
  %71 = load double, ptr %70, align 8, !tbaa !16
  %72 = call double @llvm.fmuladd.f64(double %54, double %69, double %71)
  store double %72, ptr %70, align 8, !tbaa !16
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %73 = getelementptr inbounds double, ptr %46, i64 %indvars.iv.next
  %74 = load double, ptr %73, align 8, !tbaa !16
  %75 = getelementptr inbounds double, ptr %49, i64 %indvars.iv.next
  %76 = load double, ptr %75, align 8, !tbaa !16
  %77 = call double @llvm.fmuladd.f64(double %54, double %74, double %76)
  store double %77, ptr %75, align 8, !tbaa !16
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count46
  br i1 %exitcond.not.1, label %._crit_edge.us.us, label %scalar.ph, !llvm.loop !28

._crit_edge.us.us:                                ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block
  %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
  %exitcond47.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count46
  br i1 %exitcond47.not, label %.loopexit.us, label %.lr.ph.us.us, !llvm.loop !29

78:                                               ; preds = %36
  %79 = load ptr, ptr @stderr, align 8, !tbaa !12
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef nonnull @.str.54) #7
  br label %112

.preheader:                                       ; preds = %.loopexit.us, %.preheader29
  %81 = icmp sgt i32 %38, 0
  br i1 %81, label %.lr.ph37, label %._crit_edge

.lr.ph37:                                         ; preds = %.preheader
  %82 = getelementptr inbounds i8, ptr %2, i64 8
  %83 = load ptr, ptr %82, align 8, !tbaa !15
  %wide.trip.count56 = zext nneg i32 %38 to i64
  %xtraiter62 = and i64 %wide.trip.count56, 3
  %84 = icmp ult i32 %38, 4
  br i1 %84, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph37.new

.lr.ph37.new:                                     ; preds = %.lr.ph37
  %unroll_iter = and i64 %wide.trip.count56, 2147483644
  br label %85

85:                                               ; preds = %85, %.lr.ph37.new
  %indvars.iv53 = phi i64 [ 0, %.lr.ph37.new ], [ %indvars.iv.next54.3, %85 ]
  %.036 = phi double [ 1.000000e+00, %.lr.ph37.new ], [ %105, %85 ]
  %niter = phi i64 [ 0, %.lr.ph37.new ], [ %niter.next.3, %85 ]
  %86 = getelementptr inbounds ptr, ptr %83, i64 %indvars.iv53
  %87 = load ptr, ptr %86, align 8, !tbaa !12
  %88 = getelementptr inbounds double, ptr %87, i64 %indvars.iv53
  %89 = load double, ptr %88, align 8, !tbaa !16
  %90 = fmul double %.036, %89
  %indvars.iv.next54 = or disjoint i64 %indvars.iv53, 1
  %91 = getelementptr inbounds ptr, ptr %83, i64 %indvars.iv.next54
  %92 = load ptr, ptr %91, align 8, !tbaa !12
  %93 = getelementptr inbounds double, ptr %92, i64 %indvars.iv.next54
  %94 = load double, ptr %93, align 8, !tbaa !16
  %95 = fmul double %90, %94
  %indvars.iv.next54.1 = or disjoint i64 %indvars.iv53, 2
  %96 = getelementptr inbounds ptr, ptr %83, i64 %indvars.iv.next54.1
  %97 = load ptr, ptr %96, align 8, !tbaa !12
  %98 = getelementptr inbounds double, ptr %97, i64 %indvars.iv.next54.1
  %99 = load double, ptr %98, align 8, !tbaa !16
  %100 = fmul double %95, %99
  %indvars.iv.next54.2 = or disjoint i64 %indvars.iv53, 3
  %101 = getelementptr inbounds ptr, ptr %83, i64 %indvars.iv.next54.2
  %102 = load ptr, ptr %101, align 8, !tbaa !12
  %103 = getelementptr inbounds double, ptr %102, i64 %indvars.iv.next54.2
  %104 = load double, ptr %103, align 8, !tbaa !16
  %105 = fmul double %100, %104
  %indvars.iv.next54.3 = add nuw nsw i64 %indvars.iv53, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %85, !llvm.loop !30

._crit_edge.loopexit.unr-lcssa:                   ; preds = %85, %.lr.ph37
  %.lcssa.ph = phi double [ poison, %.lr.ph37 ], [ %105, %85 ]
  %indvars.iv53.unr = phi i64 [ 0, %.lr.ph37 ], [ %indvars.iv.next54.3, %85 ]
  %.036.unr = phi double [ 1.000000e+00, %.lr.ph37 ], [ %105, %85 ]
  %lcmp.mod63.not = icmp eq i64 %xtraiter62, 0
  br i1 %lcmp.mod63.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader
  %indvars.iv53.epil = phi i64 [ %indvars.iv.next54.epil, %.epil.preheader ], [ %indvars.iv53.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.036.epil = phi double [ %110, %.epil.preheader ], [ %.036.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %106 = getelementptr inbounds ptr, ptr %83, i64 %indvars.iv53.epil
  %107 = load ptr, ptr %106, align 8, !tbaa !12
  %108 = getelementptr inbounds double, ptr %107, i64 %indvars.iv53.epil
  %109 = load double, ptr %108, align 8, !tbaa !16
  %110 = fmul double %.036.epil, %109
  %indvars.iv.next54.epil = add nuw nsw i64 %indvars.iv53.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter62
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !31

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader, %.preheader
  %.0.lcssa = phi double [ 1.000000e+00, %.preheader ], [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %110, %.epil.preheader ]
  %111 = call i32 @rc_matrix_free(ptr noundef nonnull %2)
  br label %112

112:                                              ; preds = %._crit_edge, %78, %21, %16, %12, %5
  %.022 = phi double [ -1.000000e+00, %5 ], [ -1.000000e+00, %12 ], [ %20, %16 ], [ %35, %21 ], [ -1.000000e+00, %78 ], [ %.0.lcssa, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  ret double %.022
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #5

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { cold 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 16}
!6 = !{!"rc_matrix_t", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!12 = !{!10, !10, i64 0}
!13 = !{!6, !7, i64 0}
!14 = !{!6, !7, i64 4}
!15 = !{!6, !10, i64 8}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !8, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21}
!21 = distinct !{!21, !22}
!22 = distinct !{!22, !"LVerDomain"}
!23 = !{!24}
!24 = distinct !{!24, !22}
!25 = distinct !{!25, !19, !26, !27}
!26 = !{!"llvm.loop.isvectorized", i32 1}
!27 = !{!"llvm.loop.unroll.runtime.disable"}
!28 = distinct !{!28, !19, !26}
!29 = distinct !{!29, !19}
!30 = distinct !{!30, !19}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.unroll.disable"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,LowerExpectIntrinsicPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass