; LLVM IR from KonajuGames/libsquish :: clusterfit.ll (ZN6squish10ClusterFitC2EPKNS_9ColourSetEiPf)

; 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.squish::Vec4" = type { <4 x float> }
%"class.squish::Sym3x3" = type { [6 x float] }
%"class.squish::Vec3" = type { float, float, float }
%"class.squish::ClusterFit" = type { %"class.squish::ColourFit.base", i32, %"class.squish::Vec3", [128 x i8], [16 x %"class.squish::Vec4"], %"class.squish::Vec4", %"class.squish::Vec4", %"class.squish::Vec4" }
%"class.squish::ColourFit.base" = type <{ ptr, ptr, i32 }>
%"class.squish::ColourFit" = type <{ ptr, ptr, i32, [4 x i8] }>

@_ZTVN6squish10ClusterFitE = external dso_local unnamed_addr constant { [6 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6squish10ClusterFitC2EPKNS_9ColourSetEiPf(ptr noundef nonnull align 16 dereferenceable(480) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.squish::Vec4", align 16
  %12 = alloca %"class.squish::Vec4", align 16
  %13 = alloca %"class.squish::Vec4", align 16
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca %"class.squish::Sym3x3", align 4
  %17 = alloca %"class.squish::Vec3", align 4
  %18 = alloca { <2 x float>, float }, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = load i32, ptr %7, align 4, !tbaa !9
  call void @_ZN6squish9ColourFitC2EPKNS_9ColourSetEi(ptr noundef nonnull align 8 dereferenceable(20) %19, ptr noundef %20, i32 noundef %21)
  store ptr getelementptr inbounds inrange(-16, 32) ({ [6 x ptr] }, ptr @_ZTVN6squish10ClusterFitE, i32 0, i32 0, i32 2), ptr %19, align 16, !tbaa !11
  %22 = getelementptr inbounds %"class.squish::ClusterFit", ptr %19, i32 0, i32 2
  invoke void @_ZN6squish4Vec3C2Ev(ptr noundef nonnull align 4 dereferenceable(12) %22)
          to label %23 unwind label %62

23:                                               ; preds = %4
  %24 = getelementptr inbounds %"class.squish::ClusterFit", ptr %19, i32 0, i32 4
  %25 = getelementptr inbounds [16 x %"class.squish::Vec4"], ptr %24, i32 0, i32 0
  %26 = getelementptr inbounds %"class.squish::Vec4", ptr %25, i64 16
  br label %27

27:                                               ; preds = %29, %23
  %28 = phi ptr [ %25, %23 ], [ %30, %29 ]
  invoke void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %28)
          to label %29 unwind label %62

29:                                               ; preds = %27
  %30 = getelementptr inbounds %"class.squish::Vec4", ptr %28, i64 1
  %31 = icmp eq ptr %30, %26
  br i1 %31, label %32, label %27

32:                                               ; preds = %29
  %33 = getelementptr inbounds %"class.squish::ClusterFit", ptr %19, i32 0, i32 5
  invoke void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %33)
          to label %34 unwind label %62

34:                                               ; preds = %32
  %35 = getelementptr inbounds %"class.squish::ClusterFit", ptr %19, i32 0, i32 6
  invoke void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %35)
          to label %36 unwind label %62

36:                                               ; preds = %34
  %37 = getelementptr inbounds %"class.squish::ClusterFit", ptr %19, i32 0, i32 7
  invoke void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %37)
          to label %38 unwind label %62

38:                                               ; preds = %36
  %39 = getelementptr inbounds %"class.squish::ColourFit", ptr %19, i32 0, i32 2
  %40 = load i32, ptr %39, align 16, !tbaa !13
  %41 = and i32 %40, 256
  %42 = icmp ne i32 %41, 0
  %43 = zext i1 %42 to i64
  %44 = select i1 %42, i32 8, i32 1
  %45 = getelementptr inbounds %"class.squish::ClusterFit", ptr %19, i32 0, i32 1
  store i32 %44, ptr %45, align 4, !tbaa !15
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %70

48:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #7
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = getelementptr inbounds float, ptr %49, i64 0
  %51 = load float, ptr %50, align 4, !tbaa !20
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = getelementptr inbounds float, ptr %52, i64 1
  %54 = load float, ptr %53, align 4, !tbaa !20
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = getelementptr inbounds float, ptr %55, i64 2
  %57 = load float, ptr %56, align 4, !tbaa !20
  invoke void @_ZN6squish4Vec4C2Effff(ptr noundef nonnull align 16 dereferenceable(16) %11, float noundef %51, float noundef %54, float noundef %57, float noundef 1.000000e+00)
          to label %58 unwind label %66

58:                                               ; preds = %48
  %59 = getelementptr inbounds %"class.squish::ClusterFit", ptr %19, i32 0, i32 6
  %60 = invoke noundef nonnull align 16 dereferenceable(16) ptr @_ZN6squish4Vec4aSERKS0_(ptr noundef nonnull align 16 dereferenceable(16) %59, ptr noundef nonnull align 16 dereferenceable(16) %11)
          to label %61 unwind label %66

61:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  br label %79

62:                                               ; preds = %36, %34, %32, %27, %4
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %9, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %10, align 4
  br label %125

66:                                               ; preds = %58, %48
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %9, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  br label %125

70:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  invoke void @_ZN6squish4Vec4C2Ef(ptr noundef nonnull align 16 dereferenceable(16) %12, float noundef 1.000000e+00)
          to label %71 unwind label %75

71:                                               ; preds = %70
  %72 = getelementptr inbounds %"class.squish::ClusterFit", ptr %19, i32 0, i32 6
  %73 = invoke noundef nonnull align 16 dereferenceable(16) ptr @_ZN6squish4Vec4aSERKS0_(ptr noundef nonnull align 16 dereferenceable(16) %72, ptr noundef nonnull align 16 dereferenceable(16) %12)
          to label %74 unwind label %75

74:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  br label %79

75:                                               ; preds = %71, %70
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %9, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  br label %125

79:                                               ; preds = %74, %61
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #7
  invoke void @_ZN6squish4Vec4C2Ef(ptr noundef nonnull align 16 dereferenceable(16) %13, float noundef 0x47EFFFFFE0000000)
          to label %80 unwind label %102

80:                                               ; preds = %79
  %81 = getelementptr inbounds %"class.squish::ClusterFit", ptr %19, i32 0, i32 7
  %82 = invoke noundef nonnull align 16 dereferenceable(16) ptr @_ZN6squish4Vec4aSERKS0_(ptr noundef nonnull align 16 dereferenceable(16) %81, ptr noundef nonnull align 16 dereferenceable(16) %13)
          to label %83 unwind label %102

83:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %84 = getelementptr inbounds %"class.squish::ColourFit", ptr %19, i32 0, i32 1
  %85 = load ptr, ptr %84, align 8, !tbaa !21
  %86 = invoke noundef i32 @_ZNK6squish9ColourSet8GetCountEv(ptr noundef nonnull align 4 dereferenceable(325) %85)
          to label %87 unwind label %106

87:                                               ; preds = %83
  store i32 %86, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %88 = getelementptr inbounds %"class.squish::ColourFit", ptr %19, i32 0, i32 1
  %89 = load ptr, ptr %88, align 8, !tbaa !21
  %90 = invoke noundef ptr @_ZNK6squish9ColourSet9GetPointsEv(ptr noundef nonnull align 4 dereferenceable(325) %89)
          to label %91 unwind label %110

91:                                               ; preds = %87
  store ptr %90, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #7
  %92 = load i32, ptr %14, align 4, !tbaa !9
  %93 = load ptr, ptr %15, align 8, !tbaa !5
  %94 = getelementptr inbounds %"class.squish::ColourFit", ptr %19, i32 0, i32 1
  %95 = load ptr, ptr %94, align 8, !tbaa !21
  %96 = invoke noundef ptr @_ZNK6squish9ColourSet10GetWeightsEv(ptr noundef nonnull align 4 dereferenceable(325) %95)
          to label %97 unwind label %114

97:                                               ; preds = %91
  invoke void @_ZN6squish25ComputeWeightedCovarianceEiPKNS_4Vec3EPKf(ptr dead_on_unwind writable sret(%"class.squish::Sym3x3") align 4 %16, i32 noundef %92, ptr noundef %93, ptr noundef %96)
          to label %98 unwind label %114

98:                                               ; preds = %97
  call void @llvm.lifetime.start.p0(i64 12, ptr %17) #7
  %99 = invoke { <2 x float>, float } @_ZN6squish25ComputePrincipleComponentERKNS_6Sym3x3E(ptr noundef nonnull align 4 dereferenceable(24) %16)
          to label %100 unwind label %118

100:                                              ; preds = %98
  store { <2 x float>, float } %99, ptr %18, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 8 %18, i64 12, i1 false)
  %101 = getelementptr inbounds %"class.squish::ClusterFit", ptr %19, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %101, ptr align 4 %17, i64 12, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  ret void

102:                                              ; preds = %80, %79
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %9, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #7
  br label %125

106:                                              ; preds = %83
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %9, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %10, align 4
  br label %124

110:                                              ; preds = %87
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %9, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %10, align 4
  br label %123

114:                                              ; preds = %97, %91
  %115 = landingpad { ptr, i32 }
          cleanup
  %116 = extractvalue { ptr, i32 } %115, 0
  store ptr %116, ptr %9, align 8
  %117 = extractvalue { ptr, i32 } %115, 1
  store i32 %117, ptr %10, align 4
  br label %122

118:                                              ; preds = %98
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %9, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #7
  br label %122

122:                                              ; preds = %118, %114
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #7
  br label %123

123:                                              ; preds = %122, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %124

124:                                              ; preds = %123, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %125

125:                                              ; preds = %124, %102, %75, %66, %62
  call void @_ZN6squish9ColourFitD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %19) #7
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %9, align 8
  %128 = load i32, ptr %10, align 4
  %129 = insertvalue { ptr, i32 } poison, ptr %127, 0
  %130 = insertvalue { ptr, i32 } %129, i32 %128, 1
  resume { ptr, i32 } %130
}

declare void @_ZN6squish9ColourFitC2EPKNS_9ColourSetEi(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef, i32 noundef) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6squish4Vec3C2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6squish4Vec4C2Effff(ptr noundef nonnull align 16 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6squish4Vec4C2Ef(ptr noundef nonnull align 16 dereferenceable(16), float noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6squish9ColourSet8GetCountEv(ptr noundef nonnull align 4 dereferenceable(325)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6squish9ColourSet9GetPointsEv(ptr noundef nonnull align 4 dereferenceable(325)) #2 align 2

declare void @_ZN6squish25ComputeWeightedCovarianceEiPKNS_4Vec3EPKf(ptr dead_on_unwind writable sret(%"class.squish::Sym3x3") align 4, i32 noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6squish9ColourSet10GetWeightsEv(ptr noundef nonnull align 4 dereferenceable(325)) #2 align 2

declare { <2 x float>, float } @_ZN6squish25ComputePrincipleComponentERKNS_6Sym3x3E(ptr noundef nonnull align 4 dereferenceable(24)) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: nounwind
declare void @_ZN6squish9ColourFitD2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #6

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="128" "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 nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 16}
!14 = !{!"_ZTSN6squish9ColourFitE", !6, i64 8, !10, i64 16}
!15 = !{!16, !10, i64 20}
!16 = !{!"_ZTSN6squish10ClusterFitE", !14, i64 0, !10, i64 20, !17, i64 24, !7, i64 36, !7, i64 176, !19, i64 432, !19, i64 448, !19, i64 464}
!17 = !{!"_ZTSN6squish4Vec3E", !18, i64 0, !18, i64 4, !18, i64 8}
!18 = !{!"float", !7, i64 0}
!19 = !{!"_ZTSN6squish4Vec4E", !7, i64 0}
!20 = !{!18, !18, i64 0}
!21 = !{!14, !6, i64 8}
!22 = !{i64 0, i64 4, !20, i64 4, i64 4, !20, i64 8, i64 4, !20}


; 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.squish::Vec4" = type { <4 x float> }
%"class.squish::Sym3x3" = type { [6 x float] }

@_ZTVN6squish10ClusterFitE = external dso_local unnamed_addr constant { [6 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6squish10ClusterFitC2EPKNS_9ColourSetEiPf(ptr noundef nonnull align 16 dereferenceable(480) %0, ptr noundef %1, i32 noundef %2, ptr noundef readonly %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.squish::Vec4", align 16
  %6 = alloca %"class.squish::Vec4", align 16
  %7 = alloca %"class.squish::Vec4", align 16
  %8 = alloca %"class.squish::Sym3x3", align 4
  tail call void @_ZN6squish9ColourFitC2EPKNS_9ColourSetEi(ptr noundef nonnull align 8 dereferenceable(20) %0, ptr noundef %1, i32 noundef %2)
  store ptr getelementptr inbounds inrange(-16, 32) (i8, ptr @_ZTVN6squish10ClusterFitE, i64 16), ptr %0, align 16, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN6squish4Vec3C2Ev(ptr noundef nonnull align 4 dereferenceable(12) %9)
  %.ptr = getelementptr inbounds i8, ptr %0, i64 176
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr)
  %.ptr.1 = getelementptr inbounds i8, ptr %0, i64 192
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.1)
  %.ptr.2 = getelementptr inbounds i8, ptr %0, i64 208
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.2)
  %.ptr.3 = getelementptr inbounds i8, ptr %0, i64 224
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.3)
  %.ptr.4 = getelementptr inbounds i8, ptr %0, i64 240
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.4)
  %.ptr.5 = getelementptr inbounds i8, ptr %0, i64 256
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.5)
  %.ptr.6 = getelementptr inbounds i8, ptr %0, i64 272
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.6)
  %.ptr.7 = getelementptr inbounds i8, ptr %0, i64 288
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.7)
  %.ptr.8 = getelementptr inbounds i8, ptr %0, i64 304
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.8)
  %.ptr.9 = getelementptr inbounds i8, ptr %0, i64 320
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.9)
  %.ptr.10 = getelementptr inbounds i8, ptr %0, i64 336
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.10)
  %.ptr.11 = getelementptr inbounds i8, ptr %0, i64 352
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.11)
  %.ptr.12 = getelementptr inbounds i8, ptr %0, i64 368
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.12)
  %.ptr.13 = getelementptr inbounds i8, ptr %0, i64 384
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.13)
  %.ptr.14 = getelementptr inbounds i8, ptr %0, i64 400
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.14)
  %.ptr.15 = getelementptr inbounds i8, ptr %0, i64 416
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %.ptr.15)
  %10 = getelementptr inbounds i8, ptr %0, i64 432
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 448
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %11)
  %12 = getelementptr inbounds i8, ptr %0, i64 464
  tail call void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16) %12)
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load i32, ptr %13, align 16, !tbaa !8
  %15 = and i32 %14, 256
  %.not = icmp eq i32 %15, 0
  %16 = select i1 %.not, i32 1, i32 8
  %17 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %16, ptr %17, align 4, !tbaa !13
  %.not16 = icmp eq ptr %3, null
  br i1 %.not16, label %28, label %18

18:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  %19 = load float, ptr %3, align 4, !tbaa !18
  %20 = getelementptr inbounds i8, ptr %3, i64 4
  %21 = load float, ptr %20, align 4, !tbaa !18
  %22 = getelementptr inbounds i8, ptr %3, i64 8
  %23 = load float, ptr %22, align 4, !tbaa !18
  invoke void @_ZN6squish4Vec4C2Effff(ptr noundef nonnull align 16 dereferenceable(16) %5, float noundef %19, float noundef %21, float noundef %23, float noundef 1.000000e+00)
          to label %24 unwind label %26

24:                                               ; preds = %18
  %25 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN6squish4Vec4aSERKS0_(ptr noundef nonnull align 16 dereferenceable(16) %11, ptr noundef nonnull align 16 dereferenceable(16) %5)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  br label %33

26:                                               ; preds = %18
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  br label %53

28:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  invoke void @_ZN6squish4Vec4C2Ef(ptr noundef nonnull align 16 dereferenceable(16) %6, float noundef 1.000000e+00)
          to label %29 unwind label %31

29:                                               ; preds = %28
  %30 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN6squish4Vec4aSERKS0_(ptr noundef nonnull align 16 dereferenceable(16) %11, ptr noundef nonnull align 16 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  br label %33

31:                                               ; preds = %28
  %32 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  br label %53

33:                                               ; preds = %29, %24
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #6
  invoke void @_ZN6squish4Vec4C2Ef(ptr noundef nonnull align 16 dereferenceable(16) %7, float noundef 0x47EFFFFFE0000000)
          to label %34 unwind label %46

34:                                               ; preds = %33
  %35 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN6squish4Vec4aSERKS0_(ptr noundef nonnull align 16 dereferenceable(16) %12, ptr noundef nonnull align 16 dereferenceable(16) %7)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  %36 = getelementptr inbounds i8, ptr %0, i64 8
  %37 = load ptr, ptr %36, align 8, !tbaa !19
  %38 = call noundef i32 @_ZNK6squish9ColourSet8GetCountEv(ptr noundef nonnull align 4 dereferenceable(325) %37)
  %39 = load ptr, ptr %36, align 8, !tbaa !19
  %40 = call noundef ptr @_ZNK6squish9ColourSet9GetPointsEv(ptr noundef nonnull align 4 dereferenceable(325) %39)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #6
  %41 = load ptr, ptr %36, align 8, !tbaa !19
  %42 = call noundef ptr @_ZNK6squish9ColourSet10GetWeightsEv(ptr noundef nonnull align 4 dereferenceable(325) %41)
  invoke void @_ZN6squish25ComputeWeightedCovarianceEiPKNS_4Vec3EPKf(ptr dead_on_unwind nonnull writable sret(%"class.squish::Sym3x3") align 4 %8, i32 noundef %38, ptr noundef %40, ptr noundef %42)
          to label %43 unwind label %48

43:                                               ; preds = %34
  %44 = invoke { <2 x float>, float } @_ZN6squish25ComputePrincipleComponentERKNS_6Sym3x3E(ptr noundef nonnull align 4 dereferenceable(24) %8)
          to label %45 unwind label %50

45:                                               ; preds = %43
  %.fca.0.extract = extractvalue { <2 x float>, float } %44, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %44, 1
  store <2 x float> %.fca.0.extract, ptr %9, align 8
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 32
  store float %.fca.1.extract, ptr %.sroa.5.0..sroa_idx, align 16, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  ret void

46:                                               ; preds = %33
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  br label %53

48:                                               ; preds = %34
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %52

50:                                               ; preds = %43
  %51 = landingpad { ptr, i32 }
          cleanup
  br label %52

52:                                               ; preds = %50, %48
  %.pn = phi { ptr, i32 } [ %51, %50 ], [ %49, %48 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  br label %53

53:                                               ; preds = %52, %46, %31, %26
  %.pn.pn = phi { ptr, i32 } [ %.pn, %52 ], [ %47, %46 ], [ %27, %26 ], [ %32, %31 ]
  call void @_ZN6squish9ColourFitD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %0) #6
  resume { ptr, i32 } %.pn.pn
}

declare void @_ZN6squish9ColourFitC2EPKNS_9ColourSetEi(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef, i32 noundef) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6squish4Vec3C2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6squish4Vec4C2Ev(ptr noundef nonnull align 16 dereferenceable(16)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6squish4Vec4C2Effff(ptr noundef nonnull align 16 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6squish4Vec4C2Ef(ptr noundef nonnull align 16 dereferenceable(16), float noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6squish9ColourSet8GetCountEv(ptr noundef nonnull align 4 dereferenceable(325)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6squish9ColourSet9GetPointsEv(ptr noundef nonnull align 4 dereferenceable(325)) local_unnamed_addr #2 align 2

declare void @_ZN6squish25ComputeWeightedCovarianceEiPKNS_4Vec3EPKf(ptr dead_on_unwind writable sret(%"class.squish::Sym3x3") align 4, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6squish9ColourSet10GetWeightsEv(ptr noundef nonnull align 4 dereferenceable(325)) local_unnamed_addr #2 align 2

declare { <2 x float>, float } @_ZN6squish25ComputePrincipleComponentERKNS_6Sym3x3E(ptr noundef nonnull align 4 dereferenceable(24)) local_unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN6squish9ColourFitD2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #5

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="128" "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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !12, i64 16}
!9 = !{!"_ZTSN6squish9ColourFitE", !10, i64 8, !12, i64 16}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"int", !11, i64 0}
!13 = !{!14, !12, i64 20}
!14 = !{!"_ZTSN6squish10ClusterFitE", !9, i64 0, !12, i64 20, !15, i64 24, !11, i64 36, !11, i64 176, !17, i64 432, !17, i64 448, !17, i64 464}
!15 = !{!"_ZTSN6squish4Vec3E", !16, i64 0, !16, i64 4, !16, i64 8}
!16 = !{!"float", !11, i64 0}
!17 = !{!"_ZTSN6squish4Vec4E", !11, i64 0}
!18 = !{!16, !16, i64 0}
!19 = !{!9, !10, i64 8}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass